-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathgulpfile.js
More file actions
62 lines (53 loc) · 1.46 KB
/
Copy pathgulpfile.js
File metadata and controls
62 lines (53 loc) · 1.46 KB
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
60
61
62
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
gulp.task('sass', function () {
return $.rubySass('src/sass', {style: 'expanded'})
.pipe($.autoprefixer())
.pipe(gulp.dest('src/css'));
});
gulp.task('inline-css', ['sass'], function() {
return gulp.src('src/*.html')
.pipe($.inlineCss())
.pipe(gulp.dest('dist/'));
});
gulp.task('html-min', ['inline-css'], function () {
return gulp.src('dist/**/*.html')
.pipe($.minifyHtml({
empty: true,
spare: true,
quotes: true
}))
.pipe(gulp.dest("dist"));
});
gulp.task('clean-images', function () {
return gulp.src('dist/img', {read: false})
.pipe($.clean());
});
gulp.task('images', ['clean-images'], function () {
return gulp.src('src/img/**/*')
.pipe($.imagemin({
progressive: true
}))
.pipe(gulp.dest('dist/img'));
});
// http://www.mailgun.com/
var emailOptions = {
user: 'api:key-',
url: '',
form: {
from: '',
to: '',
subject: 'The last dist'
}
};
gulp.task('send-email', function () {
return gulp.src('dist/index.html')
.pipe($.email(emailOptions));
});
gulp.task('watch', function () {
gulp.watch(['src/sass/**/*.sass', 'src/**/*.html'], ['html-min']);
gulp.watch('src/img/*', ['images']);
});
gulp.task('build', ['html-min', 'images']);
gulp.task('test', ['send-email']);
gulp.task('default', ['watch']);