armin-pfaeffle / sass-autocompile

Automatically compiles SASS files on save ‒ package for atom.io
https://atom.io/packages/sass-autocompile
MIT License
49 stars 16 forks source link

$variable in a comment block #138

Open achavazza opened 6 years ago

achavazza commented 6 years ago

I'm getting a kind of weird error:

Error: Undefined variable "$color"

/ $color is a variable inside a comment block /

So yeah, IS undefined thats why it's in a comment... There is a way to force ignore comments?

achavazza commented 6 years ago

Im sorry. I didn't know that / / comments were processed too I had replace / / to // comments hideous, but works!

dperolio commented 6 years ago

@achavazza Surprised you're getting an error there. You want it to display literally '$color'? It looks that way, so it should work as is I think. If you have $color defined before the comment and want it's value in the comment in place of $color, you can use #{$color}. You should only be getting that error if you put #{$color} in the comment and didn't define $color beforehand. EDIT: Ah, seems to depend on the compiler. Older ones seem to give that error.

armin-pfaeffle commented 6 years ago

Hey! Well, my package has no compiler itself. It uses node-sass for compilation.

I tested the following code and everything works as expected:

/*
$color is a variable inside a comment block
*/

Please ensure that you use the latest version of node-sass and check this again! Did an update fix your problem?

This is my node-sass --version output:

node-sass       4.5.3   (Wrapper)       [JavaScript]
libsass         3.5.0.beta.2    (Sass Compiler) [C/C++]