Skip to content

Commit

Permalink
feat: expose all css pre-processor's options. (close #169) (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
ulivz authored and yyx990803 committed Apr 23, 2018
1 parent 716aefe commit 8f0755a
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 5 deletions.
28 changes: 28 additions & 0 deletions docs/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
28 changes: 28 additions & 0 deletions docs/zh/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
10 changes: 5 additions & 5 deletions lib/webpack/createBaseConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,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')
Expand Down

0 comments on commit 8f0755a

Please sign in to comment.