Reputation: 737
// Create a scss theme file
gulp.task('theme-scss', function() {
return gulp.src(['./retailer-theme.json']).on('error', gutil.log)
.pipe(replace('/.*/m', 'hello')).on('error', gutil.log)
//.pipe(jsonSass({prefix: '$theme: '})).on('error', gutil.log)
/*.pipe(rename({
dirname: './',
basename: 'retailer',
suffix: '-theme',
extname: '.scss'
})).on('error', gutil.log)*/
.pipe(gulp.dest(APP_DIR + '/scss/variables/')).on('error', gutil.log)
})
Trying the replace everything in the file with the word hello.enter code here
The text in retailer-theme.json is text
.pipe(replace('text', 'hello')).on('error', gutil.log)
The above line works as expected
Upvotes: 1
Views: 1516
Reputation: 182781
Actually, if you just removed the quotes from your original regexp
.pipe(replace('/.*/m', 'hello')).on('error', gutil.log)
to
.pipe(replace(/.*/m, 'hello')).on('error', gutil.log)
I bet it works. With the quotes it just found no match.
Upvotes: 1
Reputation: 737
.pipe(replace(new RegExp('.*'), 'hello')).on('error', gutil.log)
So I had to create a regexp object, would of been nice if they had this in the docs
Upvotes: 1