Closed panstav closed 9 years ago
Hi pal,
Glad to hear you about using grunt-replace / applause ^^
In other words you need to clean unreplaced matches ? you can create a new regexp for that or not ? or i misunderstanding ?
Remember ... you can preserve patterns execution using
preserveOrder
parameter (https://github.com/outaTiME/grunt-replace#preserveorder)
Im got something like that in mind:
remote: {
files: {
'index.html': 'app.html'
},
options: {
patterns: [
{
match: 'GOOGLEANALYTICS',
replacement: '<script>lalala</script>'
},
{
// remove unused
match: /@@\w+/g,
replacement: ''
}
],
preserveOrder: true
}
}
what do you think ??
Thank you for giving the time for such an easy one. =]
Wooow, do you try it ?!? It works?!?
Title might be confusing, I'll try to clearify..
For exaple: I'm using this awesome task to insert Google Analytics into the build that goes remote. Production / Dev routine..
What I do is:
At first I thought the default
preservePrefix: false
was to remove the unused prefixes off the source code after a replace (for example, on thelocalBuild
task, when that match doesn't get replaced with the script), but obviously that's was a horrible assumption to make. So I ended up using this pattern for every replace task I write..I was wondering if you had any thoughts of a solution for this, a pool of matchers &
removeUnreplaced
, perhaps?What do you think?