css-modules / postcss-icss-values

Pass arbitrary constants between your module files
MIT License
203 stars 18 forks source link

Comments break exports #82

Closed rpunkfu closed 7 years ago

rpunkfu commented 7 years ago

I noticed (probably) a bug, when you use C style comments (//):

// Brand
@value foo: #fff;
@value foo2: #fff;
@value foo3: #fff;

// Form
@value form-foo: #fff;
@value form-foo2: #fff;

This will result in only [foo2, foo3, form-foo2] being exported, when I remove comments, all of them are exported. I don't know, maybe using C-style comments in css is bad practice, but this shouldn't be forced on user imo :)

geelen commented 7 years ago

C-style comments aren't valid CSS, the PostCSS parser gets confused as hell and basically says "NOOOPE" until it sees a ;. Hence why // kills the @value on the following line.

Not much we can do about this, you'll have to use /* comments */ I'm afraid—they're the only valid CSS comments anyway.

rpunkfu commented 7 years ago

Cool, wasn't aware of that, thanks :)

tivac commented 7 years ago

There is https://www.npmjs.com/package/postcss-comment if you really want to use 'em though.