Skip to content
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

Clarify --config flag for version 6 #233

Closed
bep opened this issue Jul 27, 2018 · 11 comments
Closed

Clarify --config flag for version 6 #233

bep opened this issue Jul 27, 2018 · 11 comments
Assignees

Comments

@bep
Copy link

bep commented Jul 27, 2018

--config flag stopped working in version 6

Works fine in 5.

gohugoio/hugo#5001

@bep
Copy link
Author

bep commented Jul 27, 2018

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.

@RyanZim
Copy link
Collaborator

RyanZim commented Jul 27, 2018

@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.

@bep
Copy link
Author

bep commented Jul 27, 2018

@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?

@RyanZim
Copy link
Collaborator

RyanZim commented Jul 27, 2018

@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.

@bep
Copy link
Author

bep commented Jul 27, 2018

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.

@RyanZim
Copy link
Collaborator

RyanZim commented Jul 27, 2018

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.

@bep
Copy link
Author

bep commented Jul 27, 2018

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

@RyanZim
Copy link
Collaborator

RyanZim commented Jul 27, 2018

Good point on the help message; I'm not crazy good with words; got any suggestions for a more precise, yet concise message?

@bep
Copy link
Author

bep commented Jul 27, 2018

--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.

@RyanZim RyanZim changed the title --config flag stopped working in version 6 Clarify --config flag for version 6 Jul 27, 2018
@RyanZim RyanZim self-assigned this Jul 27, 2018
@zivbk1
Copy link

zivbk1 commented Jul 27, 2018

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.

@mistic100
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants