Created
October 3, 2014 14:22
-
-
Save Anenth/e956e188b579f4a3cd18 to your computer and use it in GitHub Desktop.
Gulp build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gulp.task("build:html", function() { | |
var cssFilter = $.filter(path.styles.css); | |
var jsFilter = $.filter(path.scripts.distjs); | |
var gutil = require('gulp-load-utils')(['log']); | |
return gulp.src(path.html.rawBase) | |
.pipe($.useref.assets().on("error", gutil.log)) | |
.pipe(jsFilter) | |
.pipe(jsFilter.restore()) | |
.pipe(cssFilter) | |
.pipe($.csso()) | |
.pipe(cssFilter.restore()) | |
.pipe($.rev()) | |
.pipe($.useref.restore()) | |
.pipe($.useref()) | |
.pipe($.revReplace()) | |
.pipe($.rename('base.html')) | |
.pipe(gulp.dest(path.html.base)) | |
.pipe($.size({title: 'html'})); | |
}); | |
gulp.task('build:css', function() { | |
return gulp.src(path.styles.css) | |
.pipe($.csso()) | |
.pipe($.rename({ | |
suffix: ".min", | |
})) | |
.pipe(gulp.dest(path.dist)); | |
}); | |
gulp.task('build:rev', function () { | |
return gulp.src([path.styles.css, path.scripts.distjs]) | |
.pipe($.rev()) | |
.pipe(gulp.dest(path.dist)) // write rev'd assets to build dir | |
.pipe($.rev.manifest()) | |
.pipe(gulp.dest(path.dist)); // write manifest to build dir | |
}); | |
gulp.task('build', function (cb) { | |
runSequence('build:css', 'build:rev', ['build:html'], cb); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment