-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
executable file
·72 lines (62 loc) · 2.24 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
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();
var run = require('run-sequence');
var del = require('del');
var dirs = require('./package.json').config.dirs;
gulp.task('build:sass', function () {
var src = dirs.sass;
var dest = dirs.public + '/css';
plugins.util.log(plugins.util.colors.yellow('Building ' + src));
return gulp.src(src)
.pipe(plugins.sass({
outputStyle: 'compressed'
}))
.pipe(gulp.dest(dest))
.on('error', plugins.util.log);
});
gulp.task('build:js:vendor', function () {
var src = dirs.js.vendor;
var dest = dirs.public + '/js';
plugins.util.log(plugins.util.colors.yellow('Building ' + src));
return gulp.src(src)
.pipe(plugins.concat('vendor.js'))
.pipe(gulp.dest(dest))
.pipe(plugins.uglify())
.pipe(plugins.rename('vendor.min.js'))
.pipe(gulp.dest(dest))
.on('error', plugins.util.log);
});
gulp.task('build:js:main', function () {
var src = dirs.js.main;
var dest = dirs.public + '/js';
plugins.util.log(plugins.util.colors.yellow('Building ' + src));
return gulp.src(src)
.pipe(plugins.concat('main.js'))
.pipe(plugins.babel())
.pipe(gulp.dest(dest))
.pipe(plugins.uglify())
.pipe(plugins.rename('main.min.js'))
.pipe(gulp.dest(dest))
.on('error', plugins.util.log);
});
gulp.task('build:js:lint', function () {
var src = dirs.js.main;
plugins.util.log(plugins.util.colors.yellow('Linting ' + src));
return gulp.src(src)
.pipe(plugins.jshint())
.pipe(plugins.jshint.reporter(plugins.stylish));
});
gulp.task('build:js', function () {
return run(['build:js:vendor', 'build:js:main', 'build:js:lint']);
});
gulp.task('dev:watch', function () {
gulp.watch(dirs.js.main, ['build:js']);
gulp.watch(dirs.sass, ['build:sass']);
return run(['build:js', 'build:sass']);
});
gulp.task('dev:app', plugins.shell.task(['nodemon app/app.js']));
gulp.task('build:db', plugins.shell.task(['cd scripts && ./build_db.sh']));
gulp.task('dev', function () {
return run(['dev:watch', 'dev:app']);
});
gulp.task('help', plugins.taskListing);