SASS学习:Sass编译

王叨叨 | 2014-06-27 | 分类 笔记  | 标签 sass 

命令行编译

单文件转换命令

sass style.scss style.css

单文件转换命令

单文件监听命令

sass --watch style.scss:style.css

单文件监听命令

文件夹监听命令

sass --watch sassstyle:stylesheets

文件夹监听命令

我们一般常用的有 --style--sourcemap--debug-info 等。

sass --watch style.scss:style.css --style compact
sass --watch style.scss:style.css --sourcemap
sass --watch style.scss:style.css --style expanded --sourcemap
sass --watch style.scss:style.css --debug-info

--style 表示解析后的css是什么格式,有四种取值分别为:nestedexpandedcompactcompressed
--sourcemap表示开启sourcemap调试。开启sourcemap调试后,会生成一个后缀名为.css.map文件。
--debug-info表示开启debug信息,升级到3.3.0之后因为sourcemap更高级,这个debug-info就不太用了。

四种style生成后的css:

// nested
#main {
  color: #fff;
  background-color: #000; 
}
  #main p {
    width: 10em; 
}
.huge {
  font-size: 10em;
  font-weight: bold;
  text-decoration: underline;
}
// expanded
#main {
  color: #fff;
  background-color: #000;
}
#main p {
  width: 10em;
}
.huge {
  font-size: 10em;
  font-weight: bold;
  text-decoration: underline;
}
// compact
#main { color: #fff; background-color: #000; }
#main p { width: 10em; }
.huge { font-size: 10em; font-weight: bold; text-decoration: underline; }
// compressed
#main{color:#fff;background-color:#000}#main p{width:10em}.huge{font-size:10em;font-weight:bold;text-decoration:underline}

Sublime Text安装SASS Build编译

前提还是要有ruby环境,安装完之后,使用快捷键”Ctrl+b”来执行编译!

SASS Build

设置编译:编译模式,我这里选择的是压缩编译。

SASS Build

注意:编码必须是UTF-8,否则会报错!

如果觉得此篇文章对您有帮助,希望可以请我喝雪碧!请我喝雪碧

上一篇   下一篇   返回顶部