An open API service indexing awesome lists of open source software.

https://github.com/gavinning/fis-postpackager-replace

用于合并后字符串替换需求,例如某些场景下绝对路径向相对路径替换
https://github.com/gavinning/fis-postpackager-replace

Last synced: 10 months ago
JSON representation

用于合并后字符串替换需求,例如某些场景下绝对路径向相对路径替换

Awesome Lists containing this project

README

          

# fis-postpackager-replace

----
本插件将会根据配置替换字符串,适用于打包规则

```
npm install fis-postpackager-replace -g
```

```
fis.config.merge({
modules: {
// 启用插件
postpackager: ['replace']
},
settings: {
postpackager: {
// 插件配置
replace: {
// 打包规则
'/css/home.css': {
// 替换规则
// 'string[|正则修饰符]': string

// 纯字符串替换,将123替换为456
'123': '456',
'123|gi': '456',

// 绝对路径替换为相对路径,部分特殊字符需要使用\\进行转义,例如(
'url\\(/images/|gi': 'url(../images/'
}
}
}
}
})
```