How To Use A Capture Group With Gulp-replace?
gulp-replace 0.5.4 Current via gulp and rev: Goal: Copy
for $1
to "work" the same way as $&
(backreference to the whole match value).
Solution 2:
Your can use a callback as the second parameter in gulp-replace. The function was loop over each capture group. Here's an example where I am converting camelCase variables to css notation
.pipe(replace(/([A-Z])/g, function(match){
return'-'+match.toLowerCase()
}))
{camelCase1: 1, camelCase2: 2}
Becomes camel-case1 and case-case2
Post a Comment for "How To Use A Capture Group With Gulp-replace?"