我正在开发WordPress主题,并且正在尝试使用该@use
方法从另一个文件使用sass,但似乎无法正常工作。由于@import
Rule方法将很快贬值,我该如何解决该问题?我有档案
//_brand.scss
$base-color: #c6538c;
$border-dark: rgba($base-color, 0.88);
接着
//footer.scsss
@use 'brand' as b;
.footer{
padding: 0px 5%;
background-color: b.$base-color;
}
并且在编译时出现此错误
Compilation Error
Error: Invalid CSS after "...ground-color: b": expected expression (e.g. 1px, bold), was ".$font-size;"
on line 5 of sass/opt/lampp/.../sass/footer.scss
>> background-color: b.$base-color;
我正在使用“ Live Sass编译器” Visual Studio代码扩展来编译为CSS
如果要brand.scss
跨不同文件使用在文件中定义的变量,则可以使用@import
指令。要使用它,只需将以下行添加到您的footer.scss
文件中:
@import "brand";
资料来源:https : //www.w3schools.com/sass/sass_import.asp
希望我的回答对您有所帮助
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句