@import expected selector or at-rule, but not due to missing semicolon
I have this compass error
Line 3: Invalid CSS after "@charset" UTF-8 ": The expected selector or at-rule was" @import "compass';" )
The file looks like this. It doesn't even contain my own code
@charset "UTF-8"
@import 'compass';
I know people say this error occurs when a line is @import
missing a semicolon , but my file has a semicolon.
And the same files (scss and config.rb) can be easily compiled on Linux without issue.
Does anyone know what is wrong?
The configuration that gives the 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 have 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';
+3
source to share