Closed azu closed 8 years ago
May I use postcss-cli?
It seems that options.use is append-only.
Hmm. The line before does remove duplicates to allow you to re-order existing plugins, but I concede it will be difficult to remove postcss-import
.
This feature is mostly used for edge cases so I would agree with you and recommend you use postcss-cli
as that gives you far more control over plugins.
In the meantime I'll revisit the tests to ensure the feature here works as expected. Cheers
recommend you use postcss-cli as that gives you far more control over plugins.
Ok. Thanks for reply :)
If you want we could make it possible to turn off default plugins.
var customSettings = {
"use": [
/* when merged with the default options postcss-import will be here */
],
"postcss-import": false // turn off postcss-import
};
// ...
var plugins = options.use.map(function(p) {
if (options[p] === false) {
return false;
}
var plugin = require(p);
var settings = options[p];
return settings ? plugin(settings) : plugin;
}).filter(Boolean);
I think the reason it works the way it does now is we assumed that people would/should always use the default plugins to build a component. However this was before alternatives existed, like postcss-easy-import
. If we wanted to allow finer control we could override the use
array directly instead of merging additions. It would mean a user would have to list all the plugins again (which maybe annoying) but I am conscious of this tool becoming very similar to postcss-cli otherwise.
However, @giuseppeg your solution is nice and probably means the API changes far less than if we did my above suggestion.
Yep, I was just saying that it is possible. However we may want to stick with a minimal set of plugins, if then postcss-easy-import
is better or faster we could switch to it.
It's pretty much just a wrapper around postcss-import
for some of the features that got removed (like glob
) No harm in switching to it. I think it's the only package that exists this way so it might easier to do that than build a way to disable plugins
Hi, I try to use suitcss/preprocessor with postcss-easy-import and get unexpected behavior.
It seems that
options.use
is append-only.My
config.js
is following value:Actual value of suitcss/preprocessor's options:
Expected value of suitcss/preprocessor's options: