Skip to content

Conversation

@barraponto
Copy link

We currently support postcss options being a function, but not options.plugins.
This should be mostly harmless -- I wanted to provide a test but we don't currently test support for any postcss plugin, do we?

@barraponto
Copy link
Author

btw, i'm trying to follow the same pattern as postcss-loader: https://github.com/postcss/postcss-loader#plugins

barraponto added a commit to barraponto/neutrino-middleware-postcss that referenced this pull request Jul 1, 2017
PostCSS Loader suggests using a function for plugins when using inline loader options. That isn't
picked up by Vue right now, so we better suggest an array until
vuejs/vue-loader#866 is merged.
@gucong3000
Copy link

gucong3000 commented Jul 19, 2017

const loadOptions = require('postcss-load-options/lib/options.js');
const loadPlugins = require('postcss-load-plugins/lib/plugins.js');

plugins = loadPlugins(inlineConfig);
options = loadOptions(inlineConfig),

i think it is better to keep callback API sync with postcss-load-config

@barraponto
Copy link
Author

Well, it's not really my use case, but I can relate to a plugin configuration like this:

{
  loader: 'postcss-loader',
  options: {
    plugins: (loader) => [
      require('postcss-import')({ root: loader.resourcePath }),
      require('postcss-cssnext')(),
      require('autoprefixer')(),
      require('cssnano')()
    ]
  }
}

Copied from https://github.com/postcss/postcss-loader#plugins

@yyx990803 yyx990803 merged commit b748a5a into vuejs:master Jul 29, 2017
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.

3 participants