Skip to content

Instantly share code, notes, and snippets.

@htr3n
Last active July 31, 2018 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save htr3n/d91b6937e88050c4e7e820d82be2c2e1 to your computer and use it in GitHub Desktop.
Save htr3n/d91b6937e88050c4e7e820d82be2c2e1 to your computer and use it in GitHub Desktop.
const htmlmin = require("gulp-htmlmin");
//...
gulp.task("minify-html", function(done) {
let publicFolder = "./public";
let html = publicFolder + "/**/*.html";
let css = publicFolder + "/**/*.css";
let js = publicFolder + "/**/*.js";
let dest = "./dist";
log("Minifying HTML/CSS/JS in '" + publicFolder + "' to '" + dest + "'");
gulp.src(publicFolder + "/**")
.pipe(gulp.dest(dest));
gulp.src([html, css, js])
.pipe(htmlmin({ collapseWhitespace: true }))
.pipe(gulp.dest(dest))
.on("end", done);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment