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
Leading _ in classnames #1023
Comments
That code in parser is only for declaration. Are you sure, that it is PostCSS, because you show this problem on CSS Modules example, where CSS Modules can do some magic with classnames. Can you try to check AST by |
|
↓↓↓
So, |
After that
https://github.com/webpack-contrib/css-loader/blob/master/lib/processCss.js#L71 and I lose I just trying to understant what happens in postcss) Why |
If I print decl Declaration {
raws: { before: '\n _', between: ': ' },
type: 'decl',
... So, should it be like exports[decl.raws.before.trim() + decl.prop] = decl.value; ? How to get proper classname there? |
This is already ICSS ( |
Without The question is: why you remove |
@Diokuz you ask about declaration property |
@ai css-modules plugins first converts all to icss which is looks like this .localClass {} turns into :export {
localClass: 'globalClass--hash'
} And then loader extracts all info from this. |
We can concat prefixes on extracting only in one place. Nothing wrong with it. |
Well, I use Should |
@Diokuz I do ICSS utilities which will be used in all loaders and behave in the same way. |
I will close it because it is not related to PostCSS. PostCSS keeps _ in class. PostCSS removes leading _ from declaration properties, because it is illegal symbol there. |
What (ノಠ益ಠ)ノ彡┻━┻ ? 🙃 😛 :D |
I mean css-loader, css-modules-parser, core loader |
@Diokuz of course, CSS Modules uses PostCSS to parse CSS, so PostCSS by default support it. |
@ai then I still didn't get it, why it is considered as a normal behaviour to drop leading |
Nope. Normal behavior is to drop _ only in property names. If you have different wrong behavior with selectors, show it with PostCSS API example (you shown selector problem only with CSS Modules, with PostCSS you shown properties behavior which is correct). |
Im struggling with
postcss
because it removes leading underscore character in my classnames. For example (pseudocode):So, looks like it is works like that for the last three years:
postcss/lib/parser.es6
Lines 209 to 212 in d06be72
But somehow it breaks only when
css-loader
works. Whenpostcss-loader
works – it doesnt happen)Why you forbid leading underscores in classNames?
Or maybe all the magic happens in
node.raws.before
andcss-loader
doesnt handle it properly?I use
React
webpack@2
,postcss@5.2.17
css-loader@0.28.2
css-loader issue webpack-contrib/css-loader#541
The text was updated successfully, but these errors were encountered: