單文件轉換命令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