Skip to content

Not getting autoprefixer to work with extract-text-webpack-plugin #81

Closed
@badtant

Description

@badtant

Hi,

I have a working dev config for my scss like this:

var autoprefixer = require('autoprefixer');

  module: {
    loaders: [
      {
        test: /\.scss$/,
        loaders: ['style-loader', 'css-loader?sourceMap', 'postcss-loader', 'sass-loader?sourceMap']
      }
    ]
  },
  sassLoader: {
    includePaths: ['node_modules/normalize.css'],
    precision: '8',
    outputStyle: 'nested'
  },
  postcss: [ autoprefixer({ browsers: ['last 10 versions'] }) ]

Now I wanted to extract the css to a file when I build for production. I get a file with the config below. The problem is that the options for postcss (for instance autoprefixer) doesn't get applied.

var autoprefixer = require('autoprefixer');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var extractCSS = new ExtractTextPlugin('bundle.css');

  module: {
    loaders: [
      {
        test: /\.scss$/,
        loader: extractCSS.extract('style-loader', 'css-loader!postcss-loader!sass-loader')
      }
    ]
  },
  sassLoader: {
    includePaths: ['node_modules/normalize.css'],
    precision: '8',
    outputStyle: 'compressed'
  },
  postcss: [ autoprefixer({ browsers: ['last 10 versions'] }) ],
  plugins: [
    extractCSS
  ]
};

Can anyone see what I'm doing wrong?
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions