-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
59 lines (49 loc) · 1.42 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
var gulp = require('gulp');
var jade = require('gulp-jade');
var gutil = require('gulp-util');
var coffee = require('gulp-coffee');
var uglify = require('gulp-uglify');
var clean = require('gulp-clean');
var watch = require('gulp-watch');
var webserver = require('gulp-webserver');
gulp.task('default', ['watch', 'webserver']);
gulp.task('coffee', function() {
return gulp.src('./coffee/*.coffee')
.pipe(coffee({bare: true}))
// .on('error', gutil.log))
.pipe(gulp.dest('.tmp/js/'));
});
gulp.task('compress',['coffee'], function() {
return gulp.src(['js/*.js','.tmp/js/*.js'])
.pipe(uglify())
.pipe(gulp.dest('.tmp/min/'));
});
gulp.task('jade', ['compress'], function() {
var YOUR_LOCALS = {
title:'ESP Easy',
footer: "Powered by IoT Manager team"
};
return gulp.src('./jade/*.jade')
.pipe(jade({
locals: YOUR_LOCALS
}))
.pipe(gulp.dest('.tmp/'))
});
gulp.task('clean', function () {
return gulp.src(['.tmp'], {read: false})
.pipe(clean());
});
gulp.task('watch', function () {
gulp.watch('coffee/**/*.coffee', ['coffee'])
gulp.watch('.tmp/js/**/*.js', ['compress'])
gulp.watch('dist/**/*.js', ['jade'])
gulp.watch(['jade/**/*.jade','.tmp/js/*.js'], ['jade']);
});
gulp.task('webserver', ['jade'], function() {
gulp.src('.tmp/')
.pipe(webserver({
livereload: true,
directoryListing: true,
open: 'http://localhost:8000/index.html'
}));
});