fis3-parser-replacer
v1.0.1
Published
A parser for fis3 to replace string content
Downloads
1
Maintainers
Readme
fis3-parser-replacer
A parser for fis3 to replace string content
How to use
Install
npm install fis3-parser-replacer --save-dev
Add configure to fis-conf.js
// using single replace rule
fis.match('src/**.js', {
parser: fis.plugin('replacer', {
from: /xxx/g, // or string
to: 'xxx'
})
});
// using multiple replace rules
fis.match('src/**.js', {
parser: fis.plugin('replacer', {
rules: [
{
from: /xxx/g, // or string
to: 'xxx'
},
{
from: /xxx/g, // or string
to: 'xxx'
}
]
})
});
Options
from -
string|RegExp
: the regexp or string to replaceto -
string
: the content to replace fromrules -
Array.<Object>
: using multiple replace rules, the rule item propertiesfrom: the same as
to
optionto: the same as
from
option
envify -
boolean
: whether to replace theprocess.env.NODE_ENV
with the constant plain string, the string value is determined by the `isProd' optionisProd -
isProd
: whether in production environment