Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/guday/wepy-plugin-preprocess
小程序wepy框架下的 preprocess plugin配置
https://github.com/guday/wepy-plugin-preprocess
Last synced: 2 months ago
JSON representation
小程序wepy框架下的 preprocess plugin配置
- Host: GitHub
- URL: https://github.com/guday/wepy-plugin-preprocess
- Owner: guday
- Created: 2017-10-20T03:54:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-20T06:36:09.000Z (over 7 years ago)
- Last Synced: 2024-07-27T23:34:08.389Z (6 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-wepy - wepy-plugin-preprocess: wepy框架下的 preprocess plugin配置
README
# wepy-plugin-preprocess
## 用途
* 小程序wepy框架下的 preprocess plugin配置
* 对项目文件进行 preprocess 处理## 安装
```
npm install wepy-plugin-preprocess --save-dev
```## 配置`wepy.config.js`
* 为 plugins 添加 preprocess 对象,支持单个或者多个规则,多个规则可以以 Array 或者 Object 实现。
* 每个规则的filter 是个正则表达式。
* 每个规则通过context配置条件上下文。```
module.exports.plugins = {
'preprocess': { //加载 wepy-plugin-preprocess
filter: /config\.js$/, //条件
context: { //preprocess 的context参数
ENV: 'prod'
}
}
};module.exports.plugins = {
'preprocess': [
{
filter: /config\.js$/,
context: {
ENV: 'prod'
}
}, {
filter: /index\.html$/,
context: {
ENV: 'prod'
}
}
]
};module.exports.plugins = {
'preprocess': {
'process-js': {
filter: /config\.js$/,
context: {
ENV: 'prod'
}
},
'process-html': {
filter: /index\.html$/,
context: {
ENV: 'prod'
}
}
}
};
```