What's the difference between SCSS and Sass?

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

    SASS stands for Syntactically Awesome StyleSheets. It is an extension of CSS that adds power and elegance to the basic language. SASS is newly named as SCSS with some chages, but the old one SASS is also there. Before you use SCSS or SASS please see the below difference.

    An example of some SCSS and SASS syntax:

    SCSS

    $font-stack:    Helvetica, sans-serif;
    $primary-color: #333;
    
    body {
      font: 100% $font-stack;
      color: $primary-color;
    }
    
    //Mixins
    @mixin transform($property) {
      -webkit-transform: $property;
          -ms-transform: $property;
              transform: $property;
    }
    
    .box { @include transform(rotate(30deg)); }
    

    SASS

    $font-stack:    Helvetica, sans-serif
    $primary-color: #333
    
    body
      font: 100% $font-stack
      color: $primary-color
    
    //Mixins
    =transform($property)
      -webkit-transform: $property
      -ms-transform:     $property
      transform:         $property
    
    .box
      +transform(rotate(30deg))
    

    Output CSS after Compilation(Same for Both)

    body {
      font: 100% Helvetica, sans-serif;
      color: #333;
    }
    //Mixins
    .box {
      -webkit-transform: rotate(30deg);
      -ms-transform: rotate(30deg);
      transform: rotate(30deg);
    }
    

    For more guide you can see the official website.

提交回复
热议问题