0

我对 gulp 很陌生,我想为除 vendor.min.js 文件之外的所有 min.js 文件添加修订。

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'} ) );
} );

如何修改此代码以避免向 vendor.min.js 添加修订?我知道如果我们使用'!filename'我们可以排除它。但我不确定如何在这段代码中应用它?如果有人知道请帮助。在此先感谢。

4

1 回答 1

0

您可以为此使用 gulp 过滤器。

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

通过其他管道运行您的源代码,在运行您的管道之前使用 gulp-filter 过滤 vendor.min.js并在您的管道.pipe( rev() ) 之后释放您的过滤器.pipe( rev() )

于 2017-05-25T17:08:17.513 回答