const gulp = require('gulp');
const minifyHtml = require('gulp-minify-html');
const cleanCSS = require('gulp-clean-css');
const usemin = require('gulp-usemin');
const uglify = require('gulp-uglify');
const rev = require('gulp-rev');
gulp.task('copy', () =>
gulp.src(['src/favicon.png'])
.pipe(gulp.dest('dist/')));
gulp.task('sw', () =>
gulp.src(['src/service-worker.js'])
.pipe(uglify())
.pipe(gulp.dest('dist/')));
gulp.task('build', ['copy', 'sw'], function () {
return gulp.src('src/index.html')
.pipe(usemin({
css: [ rev() ],
js: [ uglify(), rev() ],
html: [ minifyHtml({ empty: true }) ],
inlinecss: [ cleanCSS, 'concat' ]
}))
.pipe(gulp.dest('dist/'));
});