What's the difference between SCSS and Sass?

前端 未结 13 2115
忘掉有多难
忘掉有多难 2020-11-22 14:51

From what I\'ve been reading, Sass is a language that makes CSS more powerful with variable and math support.

What\'s the difference with SCSS? Is it supposed to be

13条回答
  •  鱼传尺愫
    2020-11-22 15:00

    Sass (Syntactically Awesome StyleSheets) have two syntaxes:

    • a newer: SCSS (Sassy CSS)
    • and an older, original: indent syntax, which is the original Sass and is also called Sass.

    So they are both part of Sass preprocessor with two different possible syntaxes.

    The most important difference between SCSS and original Sass:

    SCSS:

    • Syntax is similar to CSS (so much that every regular valid CSS3 is also valid SCSS, but the relationship in the other direction obviously does not happen)

    • Uses braces {}

    • Uses semi-colons ;
    • Assignment sign is :
    • To create a mixin it uses the @mixin directive
    • To use mixin it precedes it with the @include directive
    • Files have the .scss extension.

    Original Sass:

    • Syntax is similar to Ruby
    • No braces
    • No strict indentation
    • No semi-colons
    • Assignment sign is = instead of :
    • To create a mixin it uses the = sign
    • To use mixin it precedes it with the + sign
    • Files have the .sass extension.

    Some prefer Sass, the original syntax - while others prefer SCSS. Either way, but it is worth noting that Sass’s indented syntax has not been and will never be deprecated.

    Conversions with sass-convert:

    # Convert Sass to SCSS
    $ sass-convert style.sass style.scss
    
    # Convert SCSS to Sass
    $ sass-convert style.scss style.sass
    

    The Sass and SCSS documentation

提交回复
热议问题