-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
58 lines (48 loc) · 1.3 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
'use strict';
var gulp = require('gulp');
var p = require('gulp-load-plugins')();
var handle = function(err) {
console.log(err); this.emit('end');
};
gulp.task('server', function() {
return p.connect.server({
root: 'dist',
port: 8000,
livereload: true
});
});
gulp.task('sass', function() {
return gulp.src('src/style/main.scss')
.pipe(p.sass({outputStyle: 'compressed'}))
.on('error', handle)
.pipe(gulp.dest('dist'))
.pipe(p.connect.reload());
});
gulp.task('scripts', function() {
return gulp.src('src/scripts/**/*.js')
.pipe(p.uglify())
.on('error', handle)
.pipe(p.concat('main.js'))
.on('error', handle)
.pipe(gulp.dest('dist'))
.pipe(p.connect.reload());
});
gulp.task('jade', function() {
return gulp.src('src/views/index.jade')
.pipe(p.jade())
.on('error', handle)
.pipe(gulp.dest('dist'))
.pipe(p.connect.reload());
});
gulp.task('images', function() {
return gulp.src('src/images/**/*')
.pipe(p.imagemin())
.on('error', handle)
.pipe(gulp.dest('dist/images'))
});
gulp.task('watch', function() {
gulp.watch('src/views/**/*.jade', ['jade']);
gulp.watch('src/style/*.scss', ['sass']);
gulp.watch('src/scripts/*.js', ['scripts']);
});
gulp.task('default', ['jade', 'sass', 'scripts', 'images', 'server', 'watch']);