RegEx does not get executed in Gulp.js

111 Views Asked by At

I was wondering why this regular expression doesn't get executed in Gulp task. 'replace' task uses gulp-replace.

RegEx

/url\((?:["'])?(?:\/?[a-zA-Z0-9])*\/([a-zA-Z0-9]{0,}\.(png|jpeg|jpg))(?:["'])?\)/g

Actual Gulp task

gulp.task('process-sass', function() {
    return gulp.src('./src/html/**/*.scss')
        .pipe(sass.sync())
        .pipe(replace(/url\((?:["'])?(?:\/?[a-zA-Z0-9])*\/([a-zA-Z0-9]{0,}\.(png|jpeg|jpg))(?:["'])?\)/g, 'url(/src/assets/$1)'))
        .pipe(minify())
        .pipe(rename(function(path) {
            path.dirname += '/';
            path.basename = 'bundle.min';
            path.extname = '.css'
        }))
        .pipe(gulp.dest('./builds/development'));
});

All help is very appreciated. Thanks.

0

There are 0 best solutions below