-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgulpfile.js
65 lines (51 loc) · 2.22 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
const gulp = require('gulp');
const livereload = require('gulp-livereload');
const sharedGulpTasks = require('./gulpTasks');
const runSequence = require('run-sequence').use(gulp);
const config = require('./server/config');
const winston = require('winston');
const _ = require('lodash');
const serverScript = __dirname + '/index.js';
const nsp = require('gulp-nsp');
gulp.task('cleanBuilt', function cleanBuilt () {
sharedGulpTasks.cleanBuilt(config.assets.BUILD_PATH);
});
gulp.task('scss:dev', function scssDev () {
sharedGulpTasks.scss.buildCSS(config.assets.client.src.scss, config.assets.client.destination.css);
});
gulp.task('vendorcss:dev', function scssDev () {
sharedGulpTasks.scss.buildVendorCSS(config.assets.client.destination.css);
});
gulp.task('scss:prod', function scssProd () {
sharedGulpTasks.scss.buildCSSProd(config.assets.client.src.scss, config.assets.client.destination.css);
});
gulp.task('vendorcss:prod', function scssDev () {
sharedGulpTasks.scss.buildVendorCSSProd('vendor.min.css', config.assets.client.destination.css);
});
// Set NODE_ENV to 'development'
gulp.task('env:dev', sharedGulpTasks.setEnv.setDev);
// Set NODE_ENV to 'production'
gulp.task('env:prod', sharedGulpTasks.setEnv.setProd);
gulp.task('nodemon', function nodemon () {
var watch = _.union(config.assets.server.views, config.assets.server.src);
sharedGulpTasks.nodemon(serverScript, watch)
.on('restart', function onRestart () {
winston.info('[nodemon] restarted dev server');
});
});
gulp.task('nsp', function nspShared (done) {
nsp({package : __dirname + '/package.json'}, done);
});
gulp.task('watch', function watch () {
livereload.listen({start : true});
gulp.watch(config.assets.client.src.scss, ['scss:dev'])
.on('change', livereload);
});
// Run the project in development mode
gulp.task('default', ['env:dev', 'cleanBuilt', 'scss:dev'], function runDefault (done) {
runSequence('vendorcss:dev', ['nodemon', 'watch'], done);
});
// Run the project in development mode
gulp.task('prod', function runProd (done) {
runSequence('env:prod', 'cleanBuilt', 'scss:prod', 'vendorcss:prod', ['nodemon'], done);
});