Sass Modules
本文最后更新于:2021年2月19日 晚上
Sass Modules
You don’t have to write all your Sass in a single file. You can split it up however you want with the @use
rule. This rule loads another Sass file as a module, which means you can refer to its variables, mixins, and functions in your Sass file with a namespace based on the filename. Using a file will also include the CSS it generates in your compiled output!
SCSS SYNTAX
_base.scss
1 |
|
styles.scss
1 |
|
CSS OUTPUT
1 |
|
Notice we’re using @use 'base';
in the styles.scss
file. When you use a file you don’t need to include the file extension. Sass is smart and will figure it out for you.
本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!