What's the difference between SCSS and Sass?

前端 未结 13 1930
忘掉有多难
忘掉有多难 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

    The Sass .sass file is visually different from .scss file, e.g.

    Example.sass - sass is the older syntax

    $color: red
    
    =my-border($color)
      border: 1px solid $color
    
    body
      background: $color
      +my-border(green)
    

    Example.scss - sassy css is the new syntax as of Sass 3

    $color: red;
    
    @mixin my-border($color) {
      border: 1px solid $color;
    }
    
    body {
      background: $color;
      @include my-border(green);
    }
    

    Any valid CSS document can be converted to Sassy CSS (SCSS) simply by changing the extension from .css to .scss.

提交回复
热议问题