alloc / cush

WIP module bundler 🎁
MIT License
0 stars 0 forks source link

postcss on entire bundle #15

Closed aleclarson closed 5 years ago

aleclarson commented 6 years ago

I don't know how often this is useful, but it wouldn't be hard to add once a post-bundle hook is added.

The configuration would be supplied by cush.config.js.

aleclarson commented 6 years ago

Here's a workaround, but it could be easier with baked-in support.

const postcss = require('postcss');
exports.css = function() {
  const plugins = [];
  const config = {};
  this.hook('bundle', (css) => {
    return postcss(plugins)
      .process(css, config)
      .then(res => ({
        content: res.css.toString(),
        map: res.map.toJSON(),
      }));
  });
};
aleclarson commented 5 years ago

This is probably never necessary. Closing.