Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add plugin.sass config #2764

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/config-detail.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,23 @@ csso: {
}
```

### plugins.sass
用来配置 `sass` 工具,设置打包过程中的 SCSS 代码编译。
具体配置可以参考[dart-sass](https://www.npmjs.com/package/dart-sass)
v1.2.23改为用[dart-sass](https://www.npmjs.com/package/dart-sass)作编译工具
v1.2.23前使用[node-sass](https://www.npmjs.com/package/node-sass)作编译工具
当需要全局注入scss文件时,可以添加两个额外参数:`resource` 、 `projectDirectory` ,具体配置方式如下:
```jsx
sass: {
resource: path.resolve(__dirname, '..', 'src/styles/variable.scss'),
// OR
// resource: ['path/to/global.variable.scss', 'path/to/global.mixin.scss']
projectDirectory: path.resolve(__dirname, '..')
}
```
resource: 如果要引入多个文件,支持数组形式传入。
projectDirectory: 项目根目录的绝对地址(若为小程序云开发模板,则应该是client目录)。

## env

用来设置一些环境变量如 `process.env.NODE_ENV`,例如我们想设置区分预览、打包来做些不同的操作,可以如下配置:
Expand Down