我希望 SCSS 文件的文件观察器忽略文件名以下划线开头的文件,例如 _buttons.scss。
我该怎么做?
最佳答案
首先向您想要忽略的文件添加 _...完成!来自 documentation :
Partials
If you have a SCSS or Sass file that you want to import but don’t want to compile to a CSS file, you can add an underscore to the beginning of the filename. This will tell Sass not to compile it to a normal CSS file. You can then import these files without using the underscore.
For example, you might have _colors.scss. Then no _colors.css file would be created, and you can do
@import "colors";
所以添加下划线就可以了。只是不要导入。
请小心命名文件,因为如果您有 style.scss
和 _style.scss
Sass 会将它们视为相同的文件名并引发错误:
>>> Change detected to: /Users/allcaps/test/style.scss
WARNING: In /Users/allcaps/test:
There are multiple files that match the name "style.scss":
_style.scss
style.scss
一个简单的解决方法是添加两个下划线:__style.scss
。
关于sass - Webstorm 6 - 如何使 scss 文件观察器忽略文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18905242/