How to exclude only vendor.min.js files in gulp task?

341 views Asked by At

I'm very new to gulp and i wanted to add revision to all the min.js files except vendor.min.js file.

var assets = $.useref.assets ( {'searchPath': '.tmp', 'types': ['css', 'js', 'import']} ); 

......

``  
    return gulp.src ( [srcFolder + '/app/*.jsp', srcFolder + '/app/auth/*.jsp'] )
        .pipe ( assets )
        .pipe ( $.if ( '*.js' , $.ngAnnotate () ) )
        .pipe( rev() ) //For adding revision
        .pipe($.useref() )
        .pipe( assets.restore() )
        .pipe( importFn )
        .pipe ( gulp.dest ( distFolder ) )
        .pipe (  $.size ( {'title': 'html'} ) );
} );

How can i modify this code to avoid adding revision to vendor.min.js? I know that if we use '!filename' we can exclude that.But im not sure how to apply that in this code? If anyone knows please help.Thanks in advance.

1

There are 1 answers

0
AudioBubble On

you can use gulp filter for that.

https://www.npmjs.com/package/gulp-filter

Run your source throught other pipes, use gulp-filter to filter vendor.min.js before running youe .pipe( rev() ) pipe and release your filter after your .pipe( rev() ) pipe