-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Make cssnano configurable #414
Conversation
There was a problem hiding this 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.
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? |
Did anyone end up testing whether cssnano already loads this config file? |
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. |
So to clarify, it would be good to merge this PR as a step toward that goal, if you agree. |
Good point. Should we also support |
I considered that, but decided it would be better to stick with exactly the
names that are already supported. E.g. if FooLanguage expects
foo.config.js, then we should only look for foo.config.js and nothing else.
This will lead to minimal confusion, because we can simply say "Go read
their docs! We do whatever they do."
Conversely, if we don't do what they do, then that would be considered a
bug on our end.
The principle here is "Users should be able to guess Parcel's behavior
without having to read the docs." In absence of information, it would be
reasonable for users to expect that Parcel supports cssnano.config.js but
not .cssnanorc{,.js}.
…On Sat, Dec 30, 2017 at 2:41 PM, Devon Govett ***@***.***> wrote:
Good point. Should we also support .cssnanorc and .cssnanorc.js names
like other things in parcel do?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#414 (comment)>,
or mute the thread
</~https://github.com/notifications/unsubscribe-auth/AADo8Jp53J_XhzkgboE2sPN7u4I_-Bqaks5tFp_6gaJpZM4RNf8E>
.
|
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 |
Closes #347.