Skip to content

Commit

Permalink
fix(webpack): fix missing postcss in less/scss/styl processing
Browse files Browse the repository at this point in the history
closes #1152
  • Loading branch information
3cp committed Oct 31, 2019
1 parent 17afc51 commit 7d74162
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions skeleton/webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ const cssRules = [
// @endif
];

// @if feat.less
const lessRules = [
{
loader: "less-loader",
options: {
includePaths: ["node_modules"]
}
}
];
// @endif

// @if feat.sass
const sassRules = [
{
Expand All @@ -51,6 +62,17 @@ const sassRules = [
];
// @endif

// @if feat.stylus
const stylusRules = [
{
loader: "stylus-loader",
options: {
includePaths: ["node_modules"]
}
}
];
// @endif

module.exports = ({ production } = {}, {extractCss, analyze, tests, hmr, port, host } = {}) => ({
resolve: {
// @if feat.typescript
Expand Down Expand Up @@ -238,13 +260,13 @@ module.exports = ({ production } = {}, {extractCss, analyze, tests, hmr, port, h
test: /\.less$/i,
use: extractCss ? [{
loader: MiniCssExtractPlugin.loader
}, ...cssRules, 'less-loader'
]: ['style-loader', ...cssRules, 'less-loader'],
}, ...cssRules, ...lessRules
]: ['style-loader', ...cssRules, ...lessRules],
issuer: /\.[tj]s$/i
},
{
test: /\.less$/i,
use: ['css-loader', 'less-loader'],
use: [...cssRules, ...lessRules],
issuer: /\.html?$/i
},
// @endif
Expand All @@ -253,13 +275,13 @@ module.exports = ({ production } = {}, {extractCss, analyze, tests, hmr, port, h
test: /\.styl$/i,
use: extractCss ? [{
loader: MiniCssExtractPlugin.loader
}, ...cssRules, 'stylus-loader'
]: ['style-loader', ...cssRules, 'stylus-loader'],
}, ...cssRules, ...stylusRules
]: ['style-loader', ...cssRules, ...stylusRules],
issuer: /\.[tj]s$/i
},
{
test: /\.styl$/i,
use: ['css-loader', 'stylus-loader'],
use: [...cssRules, ...stylusRules],
issuer: /\.html?$/i
},
// @endif
Expand All @@ -274,7 +296,7 @@ module.exports = ({ production } = {}, {extractCss, analyze, tests, hmr, port, h
},
{
test: /\.scss$/,
use: ['css-loader', 'sass-loader'],
use: [...cssRules, ...sassRules],
issuer: /\.html?$/i
},
// @endif
Expand Down

0 comments on commit 7d74162

Please sign in to comment.