Sass 是什麼?

Sass makes CSS fun again. Sass is an extension of CSS3, adding nested rules, variables, mixins, selector inheritance, and more. It’s translated to well-formatted, standard CSS using the command line tool or a web-framework plugin.

Sass has two syntaxes. The most commonly used syntax is known as “SCSS” (for “Sassy CSS”), and is a superset of CSS3’s syntax. This means that every valid CSS3 stylesheet is valid SCSS as well. SCSS files use the extension .scss.

The second, older syntax is known as the indented syntax (or just “.sass”). Inspired by Haml’s terseness, it’s intended for people who prefer conciseness over similarity to CSS. Instead of brackets and semicolons, it uses the indentation of lines to specify blocks. Files in the indented syntax use the extension .sass.

While the documentation on this site is mostly in the SCSS syntax, both syntaxes are fully supported – there is no functional difference between them. Use the syntax you prefer.

 

what-is-sass.PNG 

 

[ Will 保哥 前端小字典 ]

Sass (Syntactically Awesome Stylesheets) 是個 CSS3 的擴充語言,其中包括兩種表示法,分別是已經較少使用的舊式 sass 語法 ( 副檔名為 *.sass ) 與 另一個目前較為常用的 scss 語法 ( 附檔名為 *.scss ),SCSS 語法為 CSS 的 Superset,代表原本合法的 CSS 語法本身就是合法的 SCSS 語法。

你可以透過 sass 指令編譯 *.scss 或 *.sass 檔成為 *.css 檔案,或透過 compass 的 watch 命令監控特定資料夾,只要有檔案被異動就會自動將該檔案編輯為 *.css 檔案!

所以當我們講:「你用 Sass 了嗎?」意思通常是指:「你有用 SCSS 語法撰寫 CSS 嗎?」在溝通 Sass 時,Sass 這個字可能會代表一門技術,也可以代表一個指令列工具,也可能同時可能代表著 SCSS 或 SASS 語法,初學者可別弄亂了! (^_^)

 

 

http://sass-lang.com/