Naming imported scss files .scss or .css.scss

后端 未结 2 1245
别那么骄傲
别那么骄傲 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:35

    Honestly, I don't think it matters much. As a convention, I generally name files that will eventually be output as an actual CSS file as .css.scss and imported files as .scss.

    I do the same for .html.haml and .haml for partials.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题