Naming imported scss files .scss or .css.scss

自古美人都是妖i 提交于 2019-12-01 05:32:14

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!