Sass \`import使用领先的下划线

上海社会科学院 CSS

斯丁前端

2020-03-23

我知道最好的做法是不使用前划线就导入SASS / SCSS局部。例如

@import 'normalize-scss/normalize'; 
// this imports ./normalize-scss/_normalize.scss

我对书呆子完整性的问题是,如果使用下划线导入文件,会产生任何后果吗?

@import 'normalize-scss/_normalize';

第2672篇《Sass \`import使用领先的下划线》来自Winter(https://github.com/aiyld/aiyld.github.io)的站点

1个回答
猪猪 2020.03.23

If you add an underscore to the start of the file name, Sass won’t compile it. So, if you don’t want colors.scss to compile to colors.css, name the file _colors.scss instead. Files named this way are called partials in Sass terminology.

More about import feature in Sass you can find here

问题类别

JavaScript Ckeditor Python Webpack TypeScript Vue.js React.js ExpressJS KoaJS CSS Node.js HTML Django 单元测试 PHP Asp.net jQuery Bootstrap IOS Android