-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add support for postcss loader #17
Add support for postcss loader #17
Conversation
**Why**: Make configs that use postcss-loader pass webpack-validator and not emit the warning that `postcss` is an unknown property.
**Why**: It contains the `postcss` property, which belongs to `postcss-loader`. This shouldn't emit a warning now, since the `postcss` property was added to the accepted properties in the last commit.
Although it is (still?) allowed to just specify an array, the only documented form is specifying a function. (See https://github.com/postcss/postcss-loader). It might be a good idea to enforce the usage of the function form with the help of this validator.
**Why:** An initial stab at how validation should work (?): Steering the user towards canonical use of the loader in question by prompting him/her to match the format of the examples shown in the loader's README. This clears up user's confusion wether the format in which they specified it is still valid. The specific problem here was that I had specified the option values of postcss-plugin as an array (`postcss: [...]`) while the documentation showed them only as `postss: function() { return [...] }`. It was thus unclear to me wether some major update of the loader would break my build or if my format was still ok. Only by looking into the loaders source could I see that my format would still be ok.
Sorry it took so long for me to get to you on this one! I love it and I'm glad you want to get involved! I'm not sure how I want to handle 3rd party plugin options. Part of me wants to just include them by default, but another part of me wants to require people to explicitly import them. What I mean is, people would have to do: var validateWebpack = require('webpack-validator')
module.exports = validateWebpack(config, [
validateWebpack.postcss,
validateWebpack.eslint,
// etc...
]) Thoughts? I can see benefits/drawbacks for both. 💭 |
That's the crucial question. On one hand this is a tool to reduce tooling I wonder if it's possible to find a middleground. So maybe start integrated Just some thoughts. :) |
I'm sold. Let's do this. |
Add support for postcss loader
Do...what?😃 |
Yeah, noticed that after the fact :-) I was sold when you said:
One of the goals of this project is to reduce fatigue, not increase it! |
Ok so what does that imply for the plugin architecture I proposed? What if plugins are just required by webpack-validator itself and the user doesn't have to care about installing and configuring them? Wouldn't we get the best of two worlds: ease of setup while still being able to run ntegration tests including those blessed plugins; plus allowing webpack loader authors/contributors to maintain these validators without having to PR this project each time the plugin interface changes? Finally, users could opt-in to supplying other, not-yet-blessed or custom plugins themselves. |
That'd be cool. I definitely would like to have a spec that said: "Check the user's |
Will do. Probably will find time to work on it on the weekend. |
I added "skeletonic" support for the
postcss
property used by postcss-loader and added a webpack config of mine to verify acceptance.This is a cool project, I'd like to get involved. 👍