Reputation: 934
I have an illustrator file I'm regularly updating, that's then processed and distributed to /public/ though a Gulp task.
However, Illustrator appends _[0-9]+_
to some key tag IDs, and I want to perform something like .pipe(thisSVGFile.contents().replace('/_[0-9]+_/',""))
whenever Gulp Watch comes across a change.
How can I achieve this without producing my own Gulp plugin?
Upvotes: 0
Views: 130
Reputation: 35806
gulp-replace supports regular expressions.
var replace = require('gulp-replace');
gulp.task('replace', function () {
return gulp.src('./public/file.svg')
.pipe(replace(/_[0-9]+_/g, ''))
.pipe(gulp.dest('public'));
});
Upvotes: 1