Meteor-Community-Packages / meteor-postcss

PostCSS for Meteor

Home Page:https://packosphere.com/juliancwirko/postcss

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Different configuration for production and non-production?

mitar opened this issue · comments

commented

autoprefixer takes a lot of time. Is there a way to have a different set of plugins during development? So that autoprefixer runs only when bundling?

commented

This has been fixed by #32.

Now you can create .postcssrc.js file in the root of the app with things like:

module.exports = (ctx) => {
  if (ctx.meteor) {
    const config = {
      plugins: {
        'postcss-easy-import': {},
      },
    };

    if (ctx.env === 'production') {
      // "autoprefixer" is reported to be slow,
      // so we use it only in production.
      config.plugins.autoprefixer = {
        browsers: [
          'last 2 versions',
        ],
      };
    }

    return config;
  }
  else {
    return {};
  }
};

@mitar I haven't tested all, but is the postcss entry in package.json compatible with what was here previously? Or should I rewrite the docs for new 2.0.0 version?

commented

Yes, it should just continue to work. There are maybe some internal changes because of now using require and not Npm.require. This might improve things, but it could also break things if people were doing some workarounds. So I do not think it is a major change, but it is definitely a minor one.

commented

Before release, we could also bump the version of PostCSS, and also add some documentation about new locations where you can put configuration. I can do those pull requests if you want.

Of course. It would be better if you'll do that. I've released it, but no problem, I'll release it again.