监听及编译模式详解

监听变化自动编译

可以使用 watch 命令监听 scss 变化,并自动编译

sass --watch  test.scss test.css

编译模式

1. 默认模式

语法 sass test.scss test.css

格式 :

@charset "UTF-8";
/* 定义变量与值 */
/* 使用变量 */
.test-box {
  background-color: lightblue;
  color: darkblue;
  font-size: 16px;
  width: 300px;
  line-height: 50px;
}

2. 压缩排版格式

语法 sass test.scss test.css --style compressed

编译后格式

.test-box{background-color:#add8e6;color:#00008b;font-size:16px;width:300px;line-height:50px}