Fails when a pattern replacement is an empty string
gmetais opened this issue · 3 comments
gmetais commented
Hi and thank you for your work!
I'm having an issue with the latest version (v.0.9.1). I'm setting a pattern, and when the replacement is a empty string, the task fails.
Gruntfile.js:
replace: {
dist: {
options: {
patterns: [
{
match: 'googleAnalyticsId',
replacement: ''
// my actual replacement string is '<%= settings.gaId %>'
// but this value can be empty
}
]
},
files: [
{expand: true, flatten: true, src: ['front/src/main.html'], dest: 'front/build/'}
]
}
}
The outputed error doesn't tell much:
Running "replace:dist" (replace) task
Verifying property replace.dist exists in config...OK
Files: front/src/main.html -> front/build/main.html
Options: encoding="utf8", processContentExclude=[], mode=false, patterns=[{"match":"googleAnalyticsId","replacement":""},{"match":"version","replacement":"v1.4.1"}], excludeBuiltins=false, force, silent=false
Reading front/src/main.html...OK
Processing source...ERROR
Warning: Error while processing "front/src/main.html" file. Use --force to continue.
outaTiME commented
Oups, i will check asap ...
thks pal, probably this issue was a part of the last update ...
outaTiME commented
Fixed in 0.9.2, sorry pal my fault ... update the npm depenceny =)
thks !
gmetais commented
Works great! Thank you!