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

feat(config): add Babel-like config format #171

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

buschtoens
Copy link
Contributor

@buschtoens buschtoens commented Dec 22, 2019

This PR adds a Babel-like PostCSS plugin config format.

new EmberApp(defaults, {
  cssModules: {
    plugins: [
      require('postcss-calc'), // without any further config
      [require('postcss-preset-env'), { stage: 4 }] // with extra config
    ]
  }
});

This format, compared to the standard config format, allows ember-css-modules plugins to patch the config for PostCSS plugins. This is very useful for plugins like postcss-mixins, so that multiple ember-css-modules plugins can add mixin definitions to the same postcss-mixins instance. This would fix: postcss/postcss-mixins#104

The alternative for me would be to have a "main" ember-css-modules plugin that adds postcss-mixins and has something like a mini plugin registry itself, so that other ember-css-modules plugins can hook in there. This seems unnecessarily complex to me though.

Do you think this feature is a good idea? What would you do differently?

@buschtoens
Copy link
Contributor Author

I also thought about allowing users to pass the npm package name or a resolvable path instead of a concrete plugin instance, but I'm not sure, whether this is really necessary.

@buschtoens buschtoens changed the title docs(postcss): add Babel-like config format feat(config): add Babel-like config format Dec 22, 2019
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.

Option to ignore unresolvable mixins
1 participant