Open sntran opened 4 years ago
Probably not - for context see some more info on the history of both projects. That said I am certainly open to a patch that exports the run
module so that configuration can be read and prepared independently and passed to it. Do you want to experiment with that?
What are the differences between postcss.config.js
that you ask about and what postcss-cli-simple
expects in its -config
option?
Thanks for the trouble making the change to run
!
I came here because I don't like the bloats of the "official" postcss-cli
, and I just need to be able to use postcss
for autoprefixer in command line. I would try the new run
.
What are the differences between postcss.config.js that you ask about and what postcss-cli-simple expects in its -config option?
For one, the exporting JSON format is different. Plugins are defined in plugins
key instead of directly being in the root.
Secondly, the JS config file allows me to customize the plugins based on certain conditions. For example, autoprefixer
with different browserlist
setting.
Mostly, it's the consistency, so that users can switch between postcss-cli-simple
and postcss-cli
any time they want to.
I'm fine with you not supporting it. I'm sure I can do some renaming :)
Thanks for being open about it!
Circling back to this. It looks like your JS configuration format is not very different from postcss.config.js
, except that plugins' configuration is placed under plugins
map instead.
postcss-cli-simple
syntax:
module.exports = {
"postcss-url": {
url: function(url) { return "http://example.com/" + url; }
},
autoprefixer: {
browsers: "> 5%"
}
};
postcss.config.js
syntax:
module.exports = {
plugins: {
require('postcss-import'),
require('tailwindcss'),
autoprefixer: {
browsers: "> 5%"
},
},
}
I think, at the very least, we can add support to plugins
map for postcss-cli-simple
. It also separates plugin configuration from command line arguments.
If you're ok with that, I can work on it.
For those of us who is switching from the official
postcss-cli
topostcss-cli-simple
, being able to reuse the existingpostcss.config.js
file is great, as we don't have to config our plugins again. Are you open to support that? The official one usespostcss-load-config
under the hood, but it's kinda big, so I understand that you will not want to.