Tag: 吞咽改变

build立和注入文件只能在改变吞咽

我使用gulp注入和哈希发生器来build立我的JavaScript文件,每次都有独特的名称,以避免caching问题。build设之前,我运行gulp-clean删除以前的生成器JavaScript文件。 问题是,现在每次运行npm时,即使源代码中没有任何更改, 构build文件也正在重build。 我想在运行clean和inject之前检查源文件中是否有改变。 我认为改变了解决scheme,但不知道如何使它与散列和清理工作。 我的部分实现看起来像这样。 gulp.task('clean-scripts', function () { // return del(['./static/js/**/*.js']) return gulp.src(['./static/js/temp/**/*.js', './static/css/**/style-*.css'], {read: false}) .pipe(clean()); }); gulp.task('index', function () { var target = gulp.src('./templates/base.html'); // It's not necessary to read the files (will speed up things), we're only after their paths: var sources = gulp.src(['./static/js/temp/**/*.js', './static/css/'+cssFileName], {read: false}, {relative : true}); […]