Skip to content

Conversation

michael-ciniawsky
Copy link
Member

@michael-ciniawsky michael-ciniawsky commented Mar 28, 2017

Refactor

options.config

webpack.config.js

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

postcss.config.js

module.exports = ({ file, options /* options.ctx */, env}) => ({
   parser: file.extname  === '.sss' ? 'sugarss' : false,
   plugins: {
      'postcss-nested':  {},
      'cssnano': env === 'production' ? { safe: true } : false
   } 
})

Features

Syntax Error

Syntax Error

Options Validation Error

Validation Error

Module Export

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

options.config

Removed Loader API (ctx.webpack)

options.pack

Removed Completely

options.rewrite (webpack Plugin Hook)

Removed Completely

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants