gpt4 book ai didi

compass-sass - @import 行预期选择器或规则,但不是因为缺少分号

转载 作者:行者123 更新时间:2023-12-04 04:46:44 25 4
gpt4 key购买 nike

我有这个 compass 错误

Line 3: Invalid CSS after "@charset "UTF-8"": expected selector or at-rule, was "@import 'compass';")
该文件如下。它甚至不包含我自己的任何代码
@charset "UTF-8"
@import 'compass';
我知道人们说这个错误发生在 the @import line misses semicolon 时,但我的文件有分号。
并且相同的文件(scss 和 config.rb)可以在 linux 中轻松编译,没有问题。

有人知道出了什么问题吗?
给出错误的配置是
Windows 8.1
ruby 2.1.6p336 (2015-04-13 revision 50298) [i386-mingw32]
Compass 1.0.3 (Polaris)
Sass 3.4.16 (Selective Steve)
我尝试了很多组合
(1)
-------------------
@import 'compass';
-------------------
// only this line, no @charset line.
// Result: compilation ok, but I need charset because
// my COMMENTS (yes only comments) have UTF8 chars.
(2)
-------------------
@charset "UTF-8";

@import 'compass';
-------------------
// semicolon after @charset
// Result: compilation error:
// Invalid CP950 character "\xE2"
// because the @charset line is unrecognised
(3)
// Add this to config.rb
Encoding.default_external = 'utf-8'
// https://stackoverflow.com/a/23338595/2841279
// http://blog.pixelastic.com/2014/09/06/compass-utf-8-encoding-on-windows/
// Result: compilation error: expected selector or
// at-rule, was "@import 'compass';
(4)
// Add this to config.rb
encoding = "utf-8"
// https://stackoverflow.com/a/13987672/2841279
// Result: compilation error: expected selector or
// at-rule, was "@import 'compass';

最佳答案

看起来把它放在页面第一行以外的任何地方会导致该错误。试着把它放在最上面,看看它是否能解决这个问题。

关于compass-sass - @import 行预期选择器或规则,但不是因为缺少分号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31354858/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com