I have this compass error
Line 3: Invalid CSS after "@charset "UTF-8"": expected selector or at-rule, was "@import 'compass';")
The file is just the following. It does not even contain any of my own code
@charset "UTF-8"
@import 'compass';
I know that people say this error occurs when the @import
line misses semicolon, but my file has the semicolon.
And the same files (scss and config.rb) can be easily compiled in linux with no problems.
Does anybody know what is wrong?
The configuration which gives error is
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)
I tried many combinations
(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';
Looks like putting that anywhere other than the first line of the page results in that error. Try putting it right at the top and see if it fixes that issue.
@charset "UTF-8";
is added by the compiler e.g. sass whenever required
this is how it needs to be in order to work
@charset "UTF-8";@import 'compass';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With