-
Notifications
You must be signed in to change notification settings - Fork 47
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
Other ways to add postcss plugins #26
Comments
Would it be possible to loop through the list of plugins the user provided and add in the rehired ones if they're missing? |
@joeybaker yep we potentially could do that, I'm just questioning whether we'd ever want to remove the default plugins only to re-add them. Do you have a use case in mind? I want to gear this to be obvious for the most common cases, which at the moment feels like this:
|
Heh… well, I guess I fall in the 5%. I wanted to configure the one of the default plugins with my custom options. So, I guess your "hook" based solution would work if there was a way to pass options to the default plugins? |
:) hey, don't take my word for it - I'm just guessing about usage patterns (and going by how I'm using it personally). Can you give an example of what custom options you're passing? That will give me a better idea of how people are using it. |
Sure, for postCssModulesScope, I'm passing a custom |
Cool. I think that particular one will be more like a 50% case, and I'd like a better way to do this too :) Would it work well for you if you could configure the custom name function at the |
Totally. Works great as long as none of the other default plugins ever take options :) Maybe just have the default plugins take options the same way other plugins do? e.g. |
What I'm thinking is more like adding a Would that work for you? |
Yea, that totally makes sense. I'm saying that in addition to that though, it would be nice to have the flexibility to configure all the default plugins the same way we configure plugins we hand in. It's a "nice to have" |
Ah gotcha. I think part of the challenge here is to find the tradeoff between "everything is customizable" and "things just work". For the purpose of css-modulesify I'd rather lean to the latter and not expose too much of the inner machinery. Even though it's made up of a few different postcss plugins, we should really consider them a single thing, because they are all intended to work together in a certain way. Maybe instead of replacing or customizing individual core postcss plugins we should just allow dropping in a custom loader? Then those that want to can do whatever customizations they like there, without complicating the interface for the 80%. |
Yea. I like simplicity (and therefore the |
You might be right there :) I'm happy to try out both ways. The issue I see with customizing core plugins from css-modulesify is that we'd be exposing an API that is 2 levels deep. I'd rather we deal directly with |
Interesting. What does the CLI API look like? |
Yeah I thinking something like that. What if we said that for the CLI
If all you wanted was to pass in some custom options to the default loader, |
Makes sense. I'm not still not convinced it's simpler than allowing users to pass options to the defaults, but I also don't think the two things are mutually exclusive, so WFM! |
Thanks for nutting this out with me! I can definitely see the 2 approaches working in tandem, if we find in future there is a need for both. |
👍 |
Closing this now that we've got |
Currently if you use the
-u
option it overrides all postcss plugins, including the css-modules ones, and you have to manually add them back. I can think of some cases when you'd want to do this but it feels like militant-level modularity :)@joshgillies what would you think about a
postcssAfter
(and possiblypostcssBefore
) option, which allows you to add postcss plugins to the transformation either side of the default?The text was updated successfully, but these errors were encountered: