Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Docs: Correct the order of loaders in postcss-loader example (#1076)
Browse files Browse the repository at this point in the history
Since `postcss-loader` must be applied *after* `sass-loader` (and
before `css-loader`) according to:
https://github.com/postcss/postcss-loader#config-cascade

...whereas previously it was being applied *before* `sass-loader`,
since webpack applies loaders in the order of "last to first".

See:
#1066 (comment)
  • Loading branch information
edmorley authored Sep 6, 2018
1 parent 51299ce commit bb9b078
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/style-loader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,20 @@ module.exports = {
test: /\.(css|sass|scss)$/,
moduleTest: /\.module\.(css|sass|scss)$/,
loaders: [
// Define loaders as objects
// Define loaders as objects. Note: loaders must be specified in reverse order.
// ie: for the loaders below the actual execution order would be:
// input file -> sass-loader -> postcss-loader -> css-loader -> style-loader/mini-css-extract-plugin
{
loader: 'sass-loader',
useId: 'sass',
loader: 'postcss-loader',
options: {
includePaths: ['absolute/path/a', 'absolute/path/b']
plugins: [require('autoprefixer')]
}
},
{
loader: 'postcss-loader',
loader: 'sass-loader',
useId: 'sass',
options: {
plugins: [require('autoprefixer')]
includePaths: ['absolute/path/a', 'absolute/path/b']
}
}
]
Expand Down

0 comments on commit bb9b078

Please sign in to comment.