Skip to content

Releases: webpack-contrib/postcss-loader

v2.0.2

09 May 01:58
Compare
Choose a tag to compare

2017-05-09

Bug Fixes

  • index: 'No PostCSS Config found' (options.config) (#215) (e764761)

v2.0.1

08 May 08:19
Compare
Choose a tag to compare

2017-05-08

Bug Fixes

  • index: 'Cannot create property prev on boolean false' (options.sourceMap) (c4f0064)

v2.0.0

08 May 05:57
Compare
Choose a tag to compare

2017-05-08

Features

options.config

  • index: add ctx, ctx.file, ctx.options (0dceb2c)

webpack.config.js

{
  test: /\.css$/
  use: [ 
    { 
      loader: 'postcss-loader',
      options: { 
       config: { 
         ctx: {
           cssnext: {...options}
         } 
       }
    }
  ]
}

postcss.config.js

module.exports = ({ file, options, env }) => ({
    parser: file.extname === '.sss' ? 'sugarss' : false,
    plugins: {
      'postcss-import': { root: file.dirname },
      'cssnext': options.cssnext ? options.cssnext : false
      'cssnano': env === 'production' ? { safe: true } : false
    }    
})

Options Validation Error

  • index: add options validation (2b76df8)

Validation Error

Refactor

Syntax Error

Syntax Error

Module Export (JS Module)

ℹ️ This is especially useful for Angular 2 Users

webpack.config.js

{
  test: /\.scss$/
- use: [ 'raw-loader',  'sass-loader' ]
+ use: [ 'postcss-loader', 'sass-loader' ]
}

BREAKING CHANGES

  • Removed support for node =< v4.0.0 (LTS)
  • Removectx.webpack (Loader API) => use ctx.file, ctx.env, ctx.options
  • Remove Plugin Presets options.pack
  • Remove webpack Plugin Hook (postcss-loader-before-processing)
  • Update to PostCSS v6.0.0
  • Refactor options.config => use options.config.path/options.config.ctx (ctx.options)

webpack.config.js

{
  test: /\.css$/
  use: [ 
    { 
      loader: 'postcss-loader',
      options: { 
-      config: 'path/to/postcss.config.js'
+      config: {
+        ctx: {},
+        path: 'path/to/postcss.config.js'
+      }
      }
    }
  ]
}