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

Make cssnano configurable #414

Merged
merged 1 commit into from
Dec 31, 2017

Conversation

shawwn
Copy link
Contributor

@shawwn shawwn commented Dec 27, 2017

Closes #347.

Copy link
Contributor

@brandon93s brandon93s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For other cases where the preset was not explicitly set, cssnano will look for a section in your package.json or a cssnano.config.js, from the current working directory upwards until it reaches your home directory.

Hmm, docs imply this would be loaded automatically.

@shawwn
Copy link
Contributor Author

shawwn commented Dec 27, 2017

Yeah, I noticed that. But it's probably better for the configuration to go through Parcel's config system rather than rely on automatic behavior.

Want to test whether cssnano is currently configurable without this PR?

@devongovett
Copy link
Member

Did anyone end up testing whether cssnano already loads this config file?

@shawwn
Copy link
Contributor Author

shawwn commented Dec 30, 2017

Even if it does by default, it would be better to apply Parcel's config loading logic.

In general, Parcel should be responsible for providing all configuration. This will be necessary in order to detect which assets should be rebuilt when a config file is changed.

(Conceptually, every asset that loads a config file should add that config file as a dependency, so that when the config file changes, that asset is rebuilt.)

That's the ideal design, anyway. Parcel doesn't work that way yet, but I'm hoping to make those changes eventually.

@shawwn
Copy link
Contributor Author

shawwn commented Dec 30, 2017

So to clarify, it would be good to merge this PR as a step toward that goal, if you agree.

@devongovett
Copy link
Member

Good point. Should we also support .cssnanorc and .cssnanorc.js names like other things in parcel do?

@shawwn
Copy link
Contributor Author

shawwn commented Dec 30, 2017 via email

@devongovett devongovett merged commit 14e7880 into parcel-bundler:master Dec 31, 2017
@brandon93s
Copy link
Contributor

brandon93s commented Dec 31, 2017

The argument for detecting asset rebuild on config change is absolutely valid.

We do however need to be careful of the situation where we use localRequire and are internally resolving configurations. In this scenario, we won't have control over what version is being required and by extension what config values, format, etc are supported. In these scenarios, config resolution is best left to the module itself if supported out of the box.

devongovett pushed a commit that referenced this pull request Oct 15, 2018
devongovett pushed a commit that referenced this pull request Oct 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants