-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
76 lines (63 loc) · 1.74 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var jade = require('gulp-jade');
var stylus = require('gulp-stylus');
var sourcemaps = require('gulp-sourcemaps');
var templateCache = require('gulp-angular-templatecache');
var del = require('del');
var paths = {
scripts: ['client/app/**/*.js'],
tpl: ['client/app/**/*.jade'],
indexTpl: 'client/index.jade',
styl: ['client/assets/styles/main.styl']
};
var webroot = 'www';
var dests = {
scripts: webroot
};
var filenames = {
webchatJs: 'webchat.js',
webchatTpl: 'webchat-tpl.js'
};
gulp.task('clean', function () {
return del([webroot]);
});
gulp.task('styl', [], function () {
return gulp.src(paths.styl)
.pipe(stylus())
.pipe(gulp.dest(webroot));
});
gulp.task('index', [], function () {
return gulp.src(paths.indexTpl)
.pipe(jade({
}))
.pipe(gulp.dest(webroot));
});
gulp.task('tpl', [], function () {
return gulp.src(paths.tpl)
.pipe(jade({
}))
.pipe(templateCache(filenames.webchatTpl, {
module: 'webchat.tpl'
}))
// .pipe(sourcemaps.init())
// .pipe(concat(filenames.webchatTpl))
// .pipe(sourcemaps.write())
.pipe(gulp.dest(dests.scripts));
});
gulp.task('scripts', [], function () {
return gulp.src(paths.scripts)
.pipe(sourcemaps.init())
.pipe(concat(filenames.webchatJs))
.pipe(sourcemaps.write())
.pipe(gulp.dest(dests.scripts));
});
gulp.task('watch', function () {
gulp.watch(paths.scripts, ['scripts']);
gulp.watch(paths.tpl, ['tpl']);
gulp.watch(paths.indexTpl, ['index']);
gulp.watch(paths.styl, ['styl']);
});
gulp.task('build', ['tpl', 'index', 'scripts', 'styl']);
gulp.task('default', ['watch', 'scripts', 'tpl', 'index', 'styl']);