Naming imported scss files .scss or .css.scss

后端 未结 2 1367
别那么骄傲
别那么骄傲 2021-01-13 04:01

I was trying to get livereload working with rails 3.2, and I came across this question, of which there is a reference to not naming imported sass partials with .css.scss:

2条回答
  •  灰色年华
    2021-01-13 04:50

    If you want to include .scss file from different directory/folder in your project, you need to add underscore before the filename. For example:

    //files to include
    yourproject/sass/partials/_navbar.scss
    yourproject/sass/partials/_footer.scss
    
    //Main style.css
    yourproject/sass/style.scss
    
      @include "partials/navbar"
      @include "partials/footer"
    

    If you notice, when the .scss files were imported in the main style.scss underscores were removed. The purpose of underscore is to exclude all .scss/.sass files not to be compiled unless if it is imported in a single .scss file.

提交回复
热议问题