From ef1d7b8b440f0142a8692adacb654ce6a69e1e23 Mon Sep 17 00:00:00 2001 From: Andre Asselin Date: Thu, 18 Feb 2016 17:04:19 -0500 Subject: [PATCH 1/2] Update the README to reflect the latest useref API Add missing restore:true for the jsFilter and cssFilter --- README.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a928ae1..b9e7445 100644 --- a/README.md +++ b/README.md @@ -27,22 +27,21 @@ var uglify = require('gulp-uglify'); var csso = require('gulp-csso'); gulp.task("index", function() { - var jsFilter = filter("**/*.js"); - var cssFilter = filter("**/*.css"); - - var userefAssets = useref.assets(); + var jsFilter = filter("**/*.js", { restore: true }); + var cssFilter = filter("**/*.css", { restore: true }); + var indexHtmlFilter = filter(['**/*', '!**/index.html'], { restore: true }); return gulp.src("src/index.html") - .pipe(userefAssets) // Concatenate with gulp-useref + .pipe(useref()) // Concatenate with gulp-useref .pipe(jsFilter) .pipe(uglify()) // Minify any javascript sources .pipe(jsFilter.restore()) .pipe(cssFilter) .pipe(csso()) // Minify any CSS sources .pipe(cssFilter.restore()) - .pipe(rev()) // Rename the concatenated files - .pipe(userefAssets.restore()) - .pipe(useref()) + .pipe(indexHtmlFilter) + .pipe(rev()) // Rename the concatenated files (but not index.html) + .pipe(indexHtmlFilter.restore) .pipe(revReplace()) // Substitute in new filenames .pipe(gulp.dest('public')); }); From cc3a89359055ef20378c2cae30bc72684b7216e9 Mon Sep 17 00:00:00 2001 From: Andre Asselin Date: Thu, 18 Feb 2016 17:11:18 -0500 Subject: [PATCH 2/2] Fix calling filter's restore as a function rather than passing straight into .pipe --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b9e7445..0cc60ac 100644 --- a/README.md +++ b/README.md @@ -35,10 +35,10 @@ gulp.task("index", function() { .pipe(useref()) // Concatenate with gulp-useref .pipe(jsFilter) .pipe(uglify()) // Minify any javascript sources - .pipe(jsFilter.restore()) + .pipe(jsFilter.restore) .pipe(cssFilter) .pipe(csso()) // Minify any CSS sources - .pipe(cssFilter.restore()) + .pipe(cssFilter.restore) .pipe(indexHtmlFilter) .pipe(rev()) // Rename the concatenated files (but not index.html) .pipe(indexHtmlFilter.restore)