-
-
Notifications
You must be signed in to change notification settings - Fork 321
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
Implement a config file #91
Comments
+1 |
@ben-eb: If you find that cosmiconfig is missing something that you need, just let us know! |
Will do. 😄 |
package.json is all you need. Don't need more dumb metafiles. See https://github.com/sindresorhus/xo#config and https://github.com/sindresorhus/ava#configuration. No point in every tool creating their own config files when we can just keep all config in package.json. Less is more. I made |
@sindresorhus You're right, hadn't considered the package.json approach. I'm not a fan of having a dozen dotfiles for configuration per-project either. 😄 |
It depends on the config. Is the config for cssnano pretty small? If so, just using |
I don't like package.json cause it becomes very massive with many config. And I can't use "param": [
0
] Better use similar config language. |
@davidtheclark It really depends on how many sub-modules we will have in v4's core. Some functionality that exists today as separate modules might be consolidated, other modules might be split up into separate parts. Right now you can disable all of these modules individually, so if that is any indication of size we might be looking at a big config file. However, this is where I'd like to use presets for configuration to suit most use cases. Like most things it seems like there is no one size fits all solution. With cosmiconfig we can use either |
If you need to have massive amounts of config for a tool per project, the tool should probably support some kind of shareable config so you don't have to duplicate the config in each project. |
That's a small price to pay for ease of use and shouldn't be an issue for most. Just learn to live with it. You already have to with npm. |
the original proposal for cosmicconfig already allows for package.json AND a config.js commonJS module, which addresses both package and shareables, doesn't it ? |
Disclaimer. I have nothing invested in this as I don't personally use this project. I just want to improve upon the current metafile mess for everyone.
That shouldn't be the goal either. You should make something awesome for the 90%.
Sometimes being opinionated is a good thing. I prevents people from making dumb choices they might not even realize are dumb. I have yet to hear a good argument for why multiple config types should be supported. |
I believe the argument is that different people (like yourself) have strong opinions about how they want to configure their project, and many of those strong opinions are incompatible. |
I'm not looking for opinions about preferences. We all have our own. I'm looking for actual reasons why having it only in package.json wouldn't work for people. |
Different people have their different opinions because of different reasons. If you don't like their reasons, that's why you have a different opinion. You've heard a couple of reasons above that haven't convinced you to change your opinion, but I'm not sure you've convinced others to change theirs. So it goes. |
For the cssnano project in particular, package.json is sufficient -- CSS optimizations shouldn't have rendering side effects so can be made global. But -- completely off the cssnano topic but related to package.json's inadequacyFor other projects I think an issue is that package.json is global. How do you provide a different set of configs for a sub directory via package.json, start adding Separate RC files might be needed if you are following multiple coding standards in your own project -- e.g.: Running sass-lint over your project would result in BEM violations in Now think about a large enterprise project where there are multiple such plugins, each with its own coding style that you want to keep in line with. |
@davidtheclark My mistake for not being clear. I'm looking for technical reasons why having config only in package.json wouldn't work. Aesthetics and preferences aside. |
@davidosomething In XO we solved it this way: https://github.com/sindresorhus/xo#config-overrides
No,
Seeing how they're really different things and even with different coding style they should be separate projects. |
We're digressing a bit (should we open this discussion up somewhere else?) The carousel i was referring to was the XO method you have there will end up looking like this for a large project
|
A good reason for having a dotfile in the home directory would be for command line usage, say that you don't want to configure cssnano on a per-project basis, but are happy with using the CLI, and your configuration is different than the default. Like I wrote, this is something that I don't personally like (would rather configure on a per-project basis) but can see its utility. |
I've settled on both These two configurations are identical; {
"name": "awesome-application",
"dependencies": {
"cssnano": "^4.0.0"
},
"cssnano": {
"preset": [
"default",
{"discardComments": {"removeAll": true}}
]
}
} Or, using const defaultPreset = require('cssnano-preset-default');
module.exports = defaultPreset({
discardComments: {
removeAll: true,
},
}); |
Not until v4, because the rewrite will mean that everyone's config files will break; so I'd like to avoid making people rewrite these things too much. But I'd like to provide the option to do this; either with a
.cssnano.yml
or a.cssnanorc
. I find YAML configs to be much nicer than JSON, but don't see why we couldn't support either one through https://github.com/davidtheclark/cosmiconfig.This makes dependents such as atom-cssnano much simpler going forward.
The text was updated successfully, but these errors were encountered: