diff --git a/docs/config/README.md b/docs/config/README.md index 9bc25a3f43..8849003146 100644 --- a/docs/config/README.md +++ b/docs/config/README.md @@ -174,6 +174,34 @@ module.exports = { Options for [postcss-loader](https://github.com/postcss/postcss-loader). Note specifying this value will overwrite autoprefixer and you will need to include it yourself. +### stylus + +- Type: `Object` +- Default: `{ preferPathResolver: 'webpack' }` + +Options for [stylus-loader](https://github.com/shama/stylus-loader). + +### scss + +- Type: `Object` +- Default: `{}` + +Options for [sass-loader](https://github.com/postcss/postcss-loader) to load `*.scss` files. + +### sass + +- Type: `Object` +- Default: `{ indentedSyntax: true }` + +Options for [sass-loader](https://github.com/webpack-contrib/sass-loader) to load `*.sass` files. + +### less + +- Type: `Object` +- Default: `{}` + +Options for [less-loader](https://github.com/webpack-contrib/less-loader). + ### configureWebpack - Type: `Object | Function` diff --git a/docs/zh/config/README.md b/docs/zh/config/README.md index 89b1278d42..f8f34382d4 100644 --- a/docs/zh/config/README.md +++ b/docs/zh/config/README.md @@ -166,6 +166,34 @@ module.exports = { [postcss-loader](https://github.com/postcss/postcss-loader) 的选项,请注意,指定这个值,将会覆盖内置的 autoprefixer,所以你需要自己将它加进去。 +### stylus + +- Type: `Object` +- Default: `{ preferPathResolver: 'webpack' }` + +[stylus-loader](https://github.com/shama/stylus-loader) 的选项。 + +### scss + +- Type: `Object` +- Default: `{}` + +加载 `*.scss` 文件的 [sass-loader](https://github.com/postcss/postcss-loader) 的选项。 + +### sass + +- Type: `Object` +- Default: `{ indentedSyntax: true }` + +加载 `*.sass` 文件的 [sass-loader](https://github.com/postcss/postcss-loader) 的选项。 + +### less + +- Type: `Object` +- Default: `{}` + +[less-loader](https://github.com/webpack-contrib/less-loader) 的选项。 + ### configureWebpack - 类型: `Object | Function` diff --git a/lib/webpack/createBaseConfig.js b/lib/webpack/createBaseConfig.js index b791342822..e332356863 100644 --- a/lib/webpack/createBaseConfig.js +++ b/lib/webpack/createBaseConfig.js @@ -185,12 +185,12 @@ module.exports = function createBaseConfig ({ } createCSSRule('css', /\.css$/) - createCSSRule('scss', /\.scss$/, 'sass-loader') - createCSSRule('sass', /\.sass$/, 'sass-loader', { indentedSyntax: true }) - createCSSRule('less', /\.less$/, 'less-loader') - createCSSRule('stylus', /\.styl(us)?$/, 'stylus-loader', { + createCSSRule('scss', /\.scss$/, 'sass-loader', siteConfig.scss) + createCSSRule('sass', /\.sass$/, 'sass-loader', Object.assign({ indentedSyntax: true }, siteConfig.sass)) + createCSSRule('less', /\.less$/, 'less-loader', siteConfig.less) + createCSSRule('stylus', /\.styl(us)?$/, 'stylus-loader', Object.assign({ preferPathResolver: 'webpack' - }) + }, siteConfig.stylus)) config .plugin('vue-loader')