-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
73 lines (62 loc) · 1.54 KB
/
gulpfile.js
File metadata and controls
73 lines (62 loc) · 1.54 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
63
64
65
66
67
68
69
70
71
72
73
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
stylus = require('gulp-stylus'),
imagemin = require('gulp-imagemin')
prefixer = require('gulp-autoprefixer')
jade = require('gulp-jade')
connect = require('gulp-connect');
function errorLog(error) {
console.error.bind(error);
this.emit('end')
}
//Html compiling
gulp.task('jade', function(){
gulp.src('jade/*.jade')
.pipe(jade({pretty: true}))
//.on('error', errorLog)
.pipe(gulp.dest('build'))
.pipe(connect.reload());
});
// Script Task
// Uglifies
gulp.task('scripts', function(){
gulp.src('js/*.js')
// .pipe(uglify())
.pipe(gulp.dest('build/js'))
.pipe(connect.reload());
});
//Style Task
//Uglifies
gulp.task('stylus', function(){
gulp.src('stylus/*.styl')
.pipe(stylus({compress:false}))
.pipe(prefixer({browsers: ['last 2 versions']}))
.on('error', errorLog)
.pipe(gulp.dest('build/css'))
.pipe(connect.reload());
})
// Image Task
// Compress
gulp.task('images', function(){
gulp.src('img/*')
.pipe(imagemin())
.on('error', errorLog)
.pipe(gulp.dest('build/img'))
.pipe(connect.reload());
});
// Watch Task
// Watches JS & stylus
gulp.task('watch', function() {
gulp.watch('js/*.js', ['scripts']);
gulp.watch('jade/*.jade', ['jade']);
gulp.watch('filters/*.svg', ['jade']);
gulp.watch('stylus/*.styl', ['stylus'])
gulp.watch('img/*', ['images']);
});
gulp.task('connect', function(){
connect.server({
root: 'build',
livereload: true
});
});
gulp.task('default', ['jade', 'stylus', 'scripts', 'images', 'watch', 'connect']);