-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
48 lines (40 loc) · 1.09 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const gulp = require('gulp');
const concat = require('gulp-concat');
const gulpLoadPlugins = require('gulp-load-plugins');
const browserSync = require('browser-sync').create();
const wiredep = require('wiredep').stream;
const runSequence = require('run-sequence');
const del = require('del');
const imagemin = require('gulp-imagemin');
const reload = browserSync.reload;
const $ = gulpLoadPlugins();
gulp.task('clean', del.bind(null, ['dist']));
gulp.task('build', ['images'], () => {
return gulp.src('dist/**/*').pipe($.size({
title: '',
gzip: true
}));
});
gulp.task('images', () => {
gulp.src(['assets/**/*.jpg', 'assets/**/*.png'])
.pipe(imagemin({
progressive: true,
interlaced: true,
svgoPlugins: [{
removeUnknownsAndDefaults: false
}, {
cleanupIDs: false
}]
}))
.pipe(gulp.dest('dist/images'));
});
gulp.task('serve', () => {
browserSync.init({
notify: false,
port: 9000,
server: {
baseDir: "./"
}
});
gulp.watch(["./*.html", "./js/**/*.js"]).on('change', browserSync.reload);
});