fires once?
nicothin opened this issue · comments
Nikolay Gromov commented
http://regexr.com/3cg68 — my regex (works the way I expect that)
in my gruntfile:
replace: {
clean_html: {
options: {
patterns: [
{
match: /<script>([\s\S]*)?(\/\*[\s\S]*?\*\/)([\s\S]*)?<\/script>/gm,
replacement: '<script>$1$3<\/script>'
}
]
},
files: [
{
expand: true,
src: ['build/*.html']
}
]
},
},
my markings is the same as in the example online link
in two fragments of code that need to be replaced, but the change takes place only in one (second)
if you write in gruntfile:
replace: {
clean_html: {
options: {
patterns: [
{
match: /<script>([\s\S]*)?(\/\*[\s\S]*?\*\/)([\s\S]*)?<\/script>/gm,
replacement: '<script>$1$3<\/script>'
},
{
match: /<script>([\s\S]*)?(\/\*[\s\S]*?\*\/)([\s\S]*)?<\/script>/gm,
replacement: '<script>$1$3<\/script>'
}
]
},
files: [
{
expand: true,
src: ['build/*.html']
}
]
},
},
the two changes occur
Q: what am I doing wrong?
what to write, to not have to duplicate the pattern?
Ariel Falduto commented
Hi pal, sorry for delay ... i will check ...
thks !!!
Ariel Falduto commented
Sorry for the long wait, the patterns are executed one after another on the same source file, and from what I see you need a replacement for a replacement, the best thing is to chain the tasks together, closing it for now.