-
Notifications
You must be signed in to change notification settings - Fork 18
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
Work with other PostCSS plugins #5
Comments
Good catch! What's happening is those plugins are running before the ICSS imports are resolved, and they need to be run afterwards. I actually built this in a PR for media query support then bailed on it: https://github.com/css-modules/css-modules-loader-core/pull/18/files#diff-1fdf421c05c1140f6d71444ea2b27638R10 But you're right, this needs to find its way back into the loader. How have you been you running this, btw? |
Here is my playground: https://github.com/pauldijou/css-modules The failing cases are no longer in it, but that's the build I'm using. I did put the calc and color plugins after the modules-values ones here, but looks like it wasn't enough for all use cases. |
Right, ok, so it looks like at the moment |
Hi @geelen, what is the status on this. Would love to use |
Sorry, wrong issue number in my commit message |
Any updates? This postcss modules sounds awesome but can't use it until this gets resolved. Thanks in advance! |
Same here. As @geelen rightfully mentions, it is a problem that But even if it would, things would still not work as expected. Another example. Let's just assume we post-process the Works:
Breaks:
|
Btw, not all plugins should run after CSS Modules. A prime example being variables. In @geelen's CSS Module Values pull request he gives a compelling example of variables needing to be local (and therefore pre-processed). Btw2, this problem with postcss-custom-properties makes it basically unusable with CSS Modules Values. |
I just found out that Effectively the same situation applies to This is clearly a major reason why PostCSS and CSS Modules Values do not get along very well (yet). |
Hi any updates to this issue? |
I'm also having this issue. There is a pull request by @Strate on css-loader that provides an option named In order to use the PR, edit
And update your webpack config accordingly: module.exports = {
module: {
loaders: [
{
test: /\.css$/,
loader: 'style!css?modules&afterModules=executeAfterCSSModule',
},
]
},
cssLoader: {
executeAfterCSSModule(pipeline) {
pipeline.use(require('postcss-calc'));
},
},
// ...
} Then @value gap: 14px;
.wrapper {
margin-bottom: calc(gap * -1);
} into this: @value gap: 14px;
.wrapper {
margin-bottom: -14px;
} @sokra Would you share with us any thoughts on Strate's PR? |
@MrOrz Thanks a lot for that, works like a charm. Hopefully the PR gets accepted at some point. |
Any updates? The PR has been rejected, so what to do? |
I wrote a workaround to overcome this flaw in |
@princed You just solved a major problem in our build process! Thank you -- that plugin is awesome! |
related: #64 It works, as long as the |
Hoping I didn't do anything wrong, but I tried to use this plugin with some other PostCSS plugins and it failed when importing values.
For example, with postcss-calc, the expression is not evaluated...
So, when used alone in
padding-top
,size
is fine, but with the calc plugin, it fails with it's unique name or stuff. Same problem with colors:Crashes the build with
Not sure what went wrong with the plugin chain, but it would be awesome to seamlessly integrate with any another PostCSS plugin.
The text was updated successfully, but these errors were encountered: