为什么Sass会添加一个错误的@charset规则? [英] Why does Sass prepend an incorrect @charset rule?
问题描述
我使用
sass --watch scss:css
让Sass为每个SCSS文件(来自我的/scss
目录)自动创建CSS文件(并将它们放置在/css
目录中).
to have Sass automatically create CSS files (and put them in the /css
directory) for each SCSS file (from my /scss
directory).
在我的SCSS文件中,我有这个:
In my SCSS file I have this:
.foo::before {
content: "▶";
}
当我在浏览器中测试网页时,不会显示播放"字符-而是看到一堆带有纸箱和其他重音的怪异字母.
When I test the web page in the browser, that "play" character is not displayed - instead I see a bunch of weird letters with carons and other accents.
我检查了生成的CSS文件,并在第一行中注意到了这一点:
I inspected the generated CSS file and noticed this in the first line:
@charset "CP852";
然后我将其手动更改为此:
I then manually changed that to this:
@charset "UTF-8";
这导致我的播放"按钮正确呈现.
which resulted in my "play" button being rendered correctly.
现在,为什么Sass将字符集设置为"CP852"
?我正在用PhpStorm编写SCSS文件,该文件报告该SCSS文件确实是UTF-8编码的(我在PhpStorm的状态栏中看到了该文件).
Now, why does Sass set the charset to "CP852"
? I'm writing the SCSS file in PhpStorm which reports that the SCSS file indeed is UTF-8 encoded (I see that in the status bar of PhpStorm).
推荐答案
尝试将@charset "UTF-8";
添加到原始SCSS文件中,SASS不应覆盖它/然后添加自己的文件.
Try adding @charset "UTF-8";
to your original SCSS file, SASS shouldn't override it/add its own then.
这篇关于为什么Sass会添加一个错误的@charset规则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!