我将我的项目设置为Less in Angular,以便在我的CSS中使用变量的好处 . 但问题是我必须在每个组件中定义那些不能使其有效的变量 . 有没有办法将变量设置为globaly?
所以我想摆脱这个:
在我的组件中:
@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;
}
1 回答
这就是
@import
的用途;它允许您导入变量文件 .