Skip to content

Commit

Permalink
Add minification (#73)
Browse files Browse the repository at this point in the history
* added gulp for es6 transpiling

* ♻️ Added minify css and html tasks
  • Loading branch information
prateek3255 authored Dec 3, 2019
1 parent 1566ae3 commit aa16a39
Show file tree
Hide file tree
Showing 4 changed files with 5,190 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
build
61 changes: 61 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
const gulp = require("gulp");
const uglify = require("gulp-uglify");
const babel = require("gulp-babel");
let cleanCSS = require("gulp-clean-css");
const htmlmin = require("gulp-htmlmin");
const del = require("del");

gulp.task("clean", done => {
del.sync("build/**/*");
done();
});

gulp.task("minify-scripts", done => {
gulp
.src(["*.js", "!gulpfile.js"])
.pipe(
babel({
presets: ["@babel/preset-env"]
})
)
.pipe(uglify())
.pipe(gulp.dest("build"));
done();
});

gulp.task("minify-css", done => {
gulp
.src("*.css")
.pipe(cleanCSS())
.pipe(gulp.dest("build"));
done();
});

gulp.task("minify-html", done => {
gulp
.src("*.html")
.pipe(htmlmin({ collapseWhitespace: true }))
.pipe(gulp.dest("build"));
done();
});

gulp.task("copy", done => {
gulp
.src(["manifest.json", "images/**/*", "Roboto/**/*", "utils/**/*"], {
base: "."
})
.pipe(gulp.dest("build"));
done();
});

gulp.task(
"default",
gulp.series(
"clean",
"minify-scripts",
"minify-css",
"minify-html",
"copy",
done => done()
)
);
Loading

0 comments on commit aa16a39

Please sign in to comment.