Duplicate revision task
I've removed the duplicate revision task. Also revision was only called when trying to make a new dist. This is wrong, it should run every time a css or js file changes.
This commit is contained in:
parent
ceeb563297
commit
28525f4509
20
gulpfile.js
20
gulpfile.js
|
@ -152,6 +152,7 @@ gulp.task('revision', function(done) {
|
||||||
.pipe(rev())
|
.pipe(rev())
|
||||||
.pipe(gulp.dest('./')) // write rev'd assets to build dir
|
.pipe(gulp.dest('./')) // write rev'd assets to build dir
|
||||||
.pipe(rev.manifest())
|
.pipe(rev.manifest())
|
||||||
|
.pipe(revDel({dest: './'}))
|
||||||
.pipe(gulp.dest('./')); // write manifest to build dir
|
.pipe(gulp.dest('./')); // write manifest to build dir
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -159,7 +160,7 @@ done();
|
||||||
// Run
|
// Run
|
||||||
// gulp dist
|
// gulp dist
|
||||||
// Copies the files to the /dist folder for distribution as simple theme
|
// Copies the files to the /dist folder for distribution as simple theme
|
||||||
gulp.task( 'dist', gulp.series( 'clean-dist', 'revision', function(done) {
|
gulp.task( 'dist', gulp.series( 'clean-dist', function(done) {
|
||||||
|
|
||||||
gulp.src( ['**/*', '!' + paths.bower, '!' + paths.bower + '/**', '!' + paths.node, '!' + paths.node + '/**', '!' + paths.dev, '!' + paths.dev + '/**', '!' + paths.dist, '!' + paths.dist + '/**', '!' + paths.distprod, '!' + paths.distprod + '/**', '!' + paths.sass, '!' + paths.sass + '/**', '!readme.txt', '!readme.md', '!package.json', '!package-lock.json', '!gulpfile.js', '!gulpconfig.json', '!CHANGELOG.md', '!.travis.yml', '!jshintignore', '!codesniffer.ruleset.xml', 'rev-manifest.json', '*'], { 'buffer': false } )
|
gulp.src( ['**/*', '!' + paths.bower, '!' + paths.bower + '/**', '!' + paths.node, '!' + paths.node + '/**', '!' + paths.dev, '!' + paths.dev + '/**', '!' + paths.dist, '!' + paths.dist + '/**', '!' + paths.distprod, '!' + paths.distprod + '/**', '!' + paths.sass, '!' + paths.sass + '/**', '!readme.txt', '!readme.md', '!package.json', '!package-lock.json', '!gulpfile.js', '!gulpconfig.json', '!CHANGELOG.md', '!.travis.yml', '!jshintignore', '!codesniffer.ruleset.xml', 'rev-manifest.json', '*'], { 'buffer': false } )
|
||||||
.pipe( replace( '/js/jquery.slim.min.js', '/js' + paths.vendor + '/jquery.slim.min.js', { 'skipBinary': true } ) )
|
.pipe( replace( '/js/jquery.slim.min.js', '/js' + paths.vendor + '/jquery.slim.min.js', { 'skipBinary': true } ) )
|
||||||
|
@ -178,24 +179,11 @@ function reload( done ){
|
||||||
// BrowserSync main task
|
// BrowserSync main task
|
||||||
gulp.task( 'watch-bs', function( done ) {
|
gulp.task( 'watch-bs', function( done ) {
|
||||||
browserSync.init( cfg.browserSyncWatchFiles, cfg.browserSyncOptions );
|
browserSync.init( cfg.browserSyncWatchFiles, cfg.browserSyncOptions );
|
||||||
gulp.watch( paths.sass + '/**/*.scss', gulp.series(scss, minifycss, reload) );
|
gulp.watch( paths.sass + '/**/*.scss', gulp.series(scss, minifycss, revision, reload) );
|
||||||
gulp.watch( [paths.dev + '/js/**/*.js', 'js/**/*.js', '!js/theme.js', '!js/theme.min.js'], gulp.series( scripts, reload ) );
|
gulp.watch( [paths.dev + '/js/**/*.js', 'js/**/*.js', '!js/theme.js', '!js/theme.min.js'], gulp.series( scripts, revision, reload ) );
|
||||||
|
|
||||||
//Inside the watch task.
|
//Inside the watch task.
|
||||||
gulp.watch( paths.imgsrc + '/**', gulp.series( imagemin, reload ) );
|
gulp.watch( paths.imgsrc + '/**', gulp.series( imagemin, reload ) );
|
||||||
done();
|
done();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task( 'revision', function(done) {
|
|
||||||
// by default, gulp would pick `assets/css` as the base,
|
|
||||||
// so we need to set it explicitly:
|
|
||||||
gulp.src([paths.css + '/theme.min.css', paths.js + '/theme.min.js'], {base: './'})
|
|
||||||
.pipe(rev())
|
|
||||||
.pipe(gulp.dest('./')) // write rev'd assets to build dir
|
|
||||||
.pipe(rev.manifest())
|
|
||||||
.pipe(revDel({dest: './'}))
|
|
||||||
.pipe(gulp.dest('./')); // write manifest to build dir
|
|
||||||
done();
|
|
||||||
|
|
||||||
});
|
|
Reference in New Issue