easy-webpack / core

An easy way to create configuration files for Webpack
MIT License
68 stars 6 forks source link

Support for autoprefixer? #28

Open mikeesouth opened 7 years ago

mikeesouth commented 7 years ago

Hey,

Webpack 2 seems to have removed the postcss section and adding autoprefixer seems difficult. I tried adding it like this to my webpack.config.ts file (fetched from the aurelia skeleton-typescript-webpack):

....
var loaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
var autoprefixer = require('autoprefixer');
....
plugins: [
      new loaderOptionsPlugin({
        options: {
          postcss: [
            autoprefixer()
          ]
        }
      })
    ],
...
  html(),
  css({ filename: 'styles.css', allChunks: true, sourceMap: false,
        additionalLoaders: ['postcss'] }),
  sass({ filename: 'styles.css', allChunks: true, sourceMap: false,
         additionalLoaders: ['postcss'] }),
  json(),
  fontAndImages(),
  globalBluebird(),
...

First I imported loaderOptionsPlugin and autoprefixer, then I loaded autoprefixer as a postcss option to loaderOptionsPlugin and finally I added additionaloaders (postcss) to my css and sass @easy-webpack modules.

This did not work. Any ideas? Or maybe some kind soul would like to write @easy-webpack/config-autoprefixer? :)

niieani commented 7 years ago

Issue moved to easy-webpack/config-css #19 via ZenHub