在 Angular 中为 Less 使用全局变量
Using global variables for Less in Angular
我在 Angular 中将我的项目设置为 Less,以便在我的 CSS 中使用变量等的好处。但问题是我必须在每个组件中定义那些不能使其高效的变量。有没有办法全局设置变量?
所以我想摆脱这个:
在我的组件中少了:
@pink-color: #FC9DB5; // I want to get this from a single
// file which I import on each component
header {
background-color: @pink-color;
height: 100px;
}
这就是 @import
的用途;它允许您导入变量文件。
我在 Angular 中将我的项目设置为 Less,以便在我的 CSS 中使用变量等的好处。但问题是我必须在每个组件中定义那些不能使其高效的变量。有没有办法全局设置变量?
所以我想摆脱这个:
在我的组件中少了:
@pink-color: #FC9DB5; // I want to get this from a single
// file which I import on each component
header {
background-color: @pink-color;
height: 100px;
}
这就是 @import
的用途;它允许您导入变量文件。