Skip to content

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