Skip to content

Commit 8f0755a

Browse files
ulivzyyx990803
authored andcommitted
feat: expose all css pre-processor's options. (close #169) (#178)
1 parent 716aefe commit 8f0755a

File tree

3 files changed

+61
-5
lines changed

3 files changed

+61
-5
lines changed

docs/config/README.md

+28
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,34 @@ module.exports = {
174174

175175
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.
176176

177+
### stylus
178+
179+
- Type: `Object`
180+
- Default: `{ preferPathResolver: 'webpack' }`
181+
182+
Options for [stylus-loader](https://github.com/shama/stylus-loader).
183+
184+
### scss
185+
186+
- Type: `Object`
187+
- Default: `{}`
188+
189+
Options for [sass-loader](https://github.com/postcss/postcss-loader) to load `*.scss` files.
190+
191+
### sass
192+
193+
- Type: `Object`
194+
- Default: `{ indentedSyntax: true }`
195+
196+
Options for [sass-loader](https://github.com/webpack-contrib/sass-loader) to load `*.sass` files.
197+
198+
### less
199+
200+
- Type: `Object`
201+
- Default: `{}`
202+
203+
Options for [less-loader](https://github.com/webpack-contrib/less-loader).
204+
177205
### configureWebpack
178206

179207
- Type: `Object | Function`

docs/zh/config/README.md

+28
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,34 @@ module.exports = {
166166

167167
[postcss-loader](https://github.com/postcss/postcss-loader) 的选项,请注意,指定这个值,将会覆盖内置的 autoprefixer,所以你需要自己将它加进去。
168168

169+
### stylus
170+
171+
- Type: `Object`
172+
- Default: `{ preferPathResolver: 'webpack' }`
173+
174+
[stylus-loader](https://github.com/shama/stylus-loader) 的选项。
175+
176+
### scss
177+
178+
- Type: `Object`
179+
- Default: `{}`
180+
181+
加载 `*.scss` 文件的 [sass-loader](https://github.com/postcss/postcss-loader) 的选项。
182+
183+
### sass
184+
185+
- Type: `Object`
186+
- Default: `{ indentedSyntax: true }`
187+
188+
加载 `*.sass` 文件的 [sass-loader](https://github.com/postcss/postcss-loader) 的选项。
189+
190+
### less
191+
192+
- Type: `Object`
193+
- Default: `{}`
194+
195+
[less-loader](https://github.com/webpack-contrib/less-loader) 的选项。
196+
169197
### configureWebpack
170198

171199
- 类型: `Object | Function`

lib/webpack/createBaseConfig.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,12 @@ module.exports = function createBaseConfig ({
192192
}
193193

194194
createCSSRule('css', /\.css$/)
195-
createCSSRule('scss', /\.scss$/, 'sass-loader')
196-
createCSSRule('sass', /\.sass$/, 'sass-loader', { indentedSyntax: true })
197-
createCSSRule('less', /\.less$/, 'less-loader')
198-
createCSSRule('stylus', /\.styl(us)?$/, 'stylus-loader', {
195+
createCSSRule('scss', /\.scss$/, 'sass-loader', siteConfig.scss)
196+
createCSSRule('sass', /\.sass$/, 'sass-loader', Object.assign({ indentedSyntax: true }, siteConfig.sass))
197+
createCSSRule('less', /\.less$/, 'less-loader', siteConfig.less)
198+
createCSSRule('stylus', /\.styl(us)?$/, 'stylus-loader', Object.assign({
199199
preferPathResolver: 'webpack'
200-
})
200+
}, siteConfig.stylus))
201201

202202
config
203203
.plugin('vue-loader')

0 commit comments

Comments
 (0)