-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
59 lines (48 loc) · 1.26 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
49
50
51
52
53
54
55
56
57
58
59
var gulp = require('gulp');
var inlinesource = require('gulp-inline-source');
var inlineCss = require('gulp-inline-css');
var connect = require('gulp-connect');
var imagemin = require('gulp-imagemin');
var pngcrush = require('imagemin-pngcrush');
var zip = require('gulp-zip');
var paths = {
html: '*.html',
styles: 'styles/*.css',
images: 'images/*',
dist: 'build/'
};
gulp.task('inline', function() {
return gulp.src(paths.html)
.pipe(inlinesource())
.pipe(inlineCss({
preserveMediaQueries: true
}))
.pipe(gulp.dest(paths.dist));
});
gulp.task('imagemin', function() {
gulp.src(paths.images)
.pipe(imagemin({
use: [pngcrush()]
}))
.pipe(gulp.dest(paths.dist + 'images'));
});
gulp.task('connect', function() {
connect.server({
livereload: true
});
});
gulp.task('reload', function() {
gulp.src(paths.html)
.pipe(connect.reload());
});
gulp.task('watch', function() {
gulp.watch([paths.html, paths.styles], ['reload']);
});
gulp.task('mailchimp', function () {
return gulp.src(paths.dist+'**/*')
.pipe(zip('mailchimp.zip'))
.pipe(gulp.dest('./'));
});
gulp.task('clean', require('del').bind(null, [paths.dist]));
gulp.task('build', ['inline', 'imagemin']);
gulp.task('default', ['connect', 'watch']);