Closed bep closed 6 years ago
package: removes --config parsing
OK, I see it briefly mentioned in the release notes. That sounds a little brief without mentioning what replaced it? Also, --config
is listed in the help output.
@bep In the linked issue, you're using the flag incorrectly, --config
is used to specify a directory to look for the postcss.config.js
file in. You cannot change the filename itself.
@RyanZim note that the example in the issue worked fine in 5, but not in 6. Are you telling me that the same flag now is used for something else? I don't understand the reasoning behind this (why take away this flexibility?), but it would be less subtle for end users if you introduced another flag and deprecated the old or something.
/cc @budparr you have tested this, too, right?
@bep The old behavior was never intended or documented. The fact that it worked was a bug. We've finally fixed the bug. I realize a fair amount of people were relying on the buggy behavior, that's why it's in a major release.
If you feel we should modify the release notes to state this more explicitly, I'd be happy to do that.
If you feel we should modify the release notes to state this more explicitly
It's not in the release notes.
Why was this "never intended", and why is the new behavior considered "better"? Now, if you want multiple setups, you're forced to create multiple directories, which sounds like a much worse situation than the old "buggy" implementation.
TBH, I'm personally not a huge fan of the way --config
works, but this system of requiring the file to be named postcss.config.js
is an PostCSS ecosystem standard used by postcss-loader
and others, and I'm trying to keep the CLI compliant with this standard.
If you need multiple setups, the preferred method of handling this is to export a function that returns different values based on ctx.env
, then select the config you want on the CLI with --env
.
OK, thanks for the explanation. I'll keep this issue open if you want to use it to track a change in the release notes. I would also consider making this help text more specific:
--config Set a custom path to look for a config file
Good point on the help message; I'm not crazy good with words; got any suggestions for a more precise, yet concise message?
--config Set a custom path to look for a config file
I think it's "path" that gets ambigous very fast.
--config Set a custom directory to look for a config file
Is probably better.
If I understand this correctly, the filename is fixed and all we would need to pass to the config parameter is the directory the file is in. With the default location being in the site root directory.
It's a shame we cannot override file name, I like my config files to start with a dot because they are not relevant to the code itself, and this way they are all grouped in the files list. Also it is not coherent with every other tools out there (rollup, webpack, uglify) whose "--config" parameter points to a file.
--config flag stopped working in version 6
Works fine in 5.
https://github.com/gohugoio/hugo/issues/5001