单文件转换命令css
sass style.scss style.css
单文件监听命令html
sass --watch style.scss:style.css
文件夹监听命令git
sass --watch sassFileDirectory:cssFileDirectory
css文件转成sass/scss文件(在线转换工具css2sass)github
sass-convert style.css style.sass sass-convert style.css style.scss
运行命令行帮助文档,能够得到全部的配置选项web
sass -h
咱们通常经常使用的有--style
,--sourcemap
,--debug-info
等。sass
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是什么格式,有四种取值分别为:nested
,expanded
,compact
,compressed
。--sourcemap
表示开启sourcemap调试。开启sourcemap调试后,会生成一个后缀名为.css.map
文件。--debug-info
表示开启debug信息,升级到3.3.0以后由于sourcemap更高级,这个debug-info就不太用了。// 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}
这里推荐koala,它是一个优秀的免费编译器,界面清晰简洁,操做起来也很是简单,详细的你们能够移歩到:Less/Sass编译工具,koala使用指南,简单操做以下图:网络
某些高上大的编辑器自己就内置了sass的编译,如webstorm等,而对于sublime text也有相应的插件能够使用:编译,保存即编译。若是不清楚你的编辑器是否拥有自动编译的功能,可谷歌百度。app
sassmeister提供了在线编译。koa
文章内容源于网络webstorm