最近尝试学习Vue3,来重建自己的博客后台。
把项目css文件后缀改成scss,结果报错:
Preprocessor dependency "sass" not found. Did you install it?
既然提示没安装sass,那就把它装上就好了:
yarn add sass
一行命令就搞定了,就是这么easy!
至于,scss和css有啥区别?
一句话,scss支持变量
例如如下:
$themeColor: red;
$themeFontColor: white;
.navbar{
background:$themeColor;
color:$themeFontColor;
height:80px;
}
暂时我能看到scss的好处就是:
通过变量来定义主题色,以后如果要改主题样式,改几个变量的值就搞定了。