Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indented syntax and quoted @charset 'UTF-8' #845

Closed
molily opened this issue Jan 19, 2015 · 6 comments
Closed

Indented syntax and quoted @charset 'UTF-8' #845

molily opened this issue Jan 19, 2015 · 6 comments

Comments

@molily
Copy link
Contributor

molily commented Jan 19, 2015

When using the indented syntax, @charset requires a non-quoted encoding.

Fails:

@charset 'UTF-8'
@charset "UTF-8"

Gives an error “invalid top-level expression”

Full example: https://gist.github.com/molily/1928a48b89c5d793579c (via Node)

Works:

@charset UTF-8

Is this deliberate behavior?

In contrast, Ruby Sass accepts these two forms:

@charset 'UTF-8'
@charset "UTF-8"

… which is what I would expect.

Did I miss something? Thanks in advance. :)

@am11
Copy link
Contributor

am11 commented Jan 19, 2015

Nice catch!

test.scss:

@charset 'UTF-8';

*{
  color: red;
}

Produces * {\n color: red; }\n, but with test.sass:

@charset 'UTF-8'

*
  color: red

Throws:

{ status: 1,
file: 'c:/temp/test.sass',
line: 1,
column: 18,
message: 'invalid top-level expression',
code: 1 }

@xzyfer, is skipping @charset directive from emitting into output by design (spec)?

@xzyfer
Copy link
Contributor

xzyfer commented Jan 19, 2015

@am11 @charset UTF-8 is omitted if there are no utf-8 characters in the output. This is by design.

@xzyfer
Copy link
Contributor

xzyfer commented Jan 19, 2015

@molily thanks for the bug report we'll aim to fix this in 3.2

@am11
Copy link
Contributor

am11 commented Jan 29, 2015

@xzyfer, few more notes. It turned out the be the issue at sass2scss conversion step. I placed a breakpoint at file.cpp#L282 and here is what I have found:

Before (.sass):

@charset 'UTF-8'

*
  color: red

After transform (.scss):

@charset 'UTF-8' {}

* {
  color: red; }

Expected after transform (.scss):

@charset 'UTF-8';

* {
  color: red; }

//cc @mgreter

(Disclaimer: I am testing with v3.1.0 not the latest master)

@baires
Copy link

baires commented Jan 29, 2015

Any news abut this issue? I'm also stuck

@molily
Copy link
Contributor Author

molily commented Feb 10, 2015

Thanks a lot for your work. 😆

@mgreter mgreter self-assigned this Mar 10, 2015
saper added a commit to saper/sass-spec that referenced this issue Sep 20, 2015
Requires indented syntax support.

sass/libsass#845
saper added a commit to sass/sass-spec that referenced this issue Sep 22, 2015
Requires indented syntax support.

sass/libsass#845
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants