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

SASS inside Pug template gives Invalid CSS #68

Closed
gawin opened this issue May 14, 2016 · 2 comments
Closed

SASS inside Pug template gives Invalid CSS #68

gawin opened this issue May 14, 2016 · 2 comments
Assignees

Comments

@gawin
Copy link

gawin commented May 14, 2016

When using a SASS style tag inside a Pug template (formally Jade) I receive the following error:

Error: Invalid CSS after " ": expected 1 selector or at-rule, was "{ h1 {"

SASS failing example tag

//- Filename: sass-inside-pug.tag
sass-inside-pug
  h1 SASS
  h2 Inside Nug

  style(type="sass").
    h1
      color: red
    h2
      color: orange

CLI arguments
riot --template pug --style sass -w src/tags build/js/tags.js

If you look closely at the error message you'll see that the h1 tag itself is enclosed inside a { curly bracket block. Looking at the error message if seems that because the entire CSS is automatically wrapped inside a { } block, that that might be the issue here. Notice that the SASS itself is rendered correctly.

Now if we would add the option indentedSyntax: false and add the correct curly brackets, then the result is compiled correctly.

Note that using indentedSyntax: false is only an example to indicate that the problem is probably caused by the default indentedSyntax: true. Of course we don't want to use curly brackets at all with SASS, so the indentedSyntax: true should just work.

SASS with indentedSyntax: false working example tag

//- Filename: sass-inside-pug-without-indented-syntax.tag
sass-inside-pug-without-indented-syntax
  h1 SASS
  h2 Inside Nug

  style(type="sass", options="{"indentedSyntax": false }"). 
    h1{
      color: red
    }
    h2{
      color: orange
    }

Used versions
riot-cli: 2.5.0
riot-compiler: 2.4.1
node-sass: 3.7.0
libsass: 3.3.6

Any help is really appreciated, would ❤️ to see this fixed!

@aMarCruz
Copy link
Contributor

aMarCruz commented Aug 30, 2016

Fixed in v2.5.4, sorry by the delay.

@gawin
Copy link
Author

gawin commented Aug 30, 2016

Great, thx for the fix @aMarCruz! 👍

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

3 participants