-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
48 lines (42 loc) · 1.23 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
var gulp = require('gulp'),
nodemon = require('gulp-nodemon'),
jshint = require('gulp-jshint'),
browserify = require('browserify'),
reactify = require('reactify'),
watch = require('gulp-watch'),
source = require('vinyl-source-stream'),
path = require('path');
gulp.task('develop', ['browserify', 'nodemon']);
gulp.task('lint', function () {
gulp.src('./**/*.jsx')
.pipe(jshint())
})
gulp.task('browserify', function() {
var b = browserify();
b.transform(reactify); // use the reactify transform
b.add('./src/client/app.js');
return b.bundle()
.pipe(source('app.js'))
.pipe(gulp.dest('./src/client/public/assets/javascript'));
});
gulp.task('nodemon', function() {
nodemon({
script: 'src/server/routes.js'
, ext: 'js jsx html'
, tasks: function (changedFiles) {
var tasks = []
changedFiles.forEach(function (file) {
if (path.extname(file) === '.jsx' && !~tasks.indexOf('lint')) {
tasks.push('lint');
}
})
if (!~tasks.indexOf('browserify')) {
tasks.push('browserify');
}
return tasks
}
, ignore: ['node_modules/**', 'Gulpfile.js']
, env: { 'NODE_ENV': 'development' }
})
});
module.exports = gulp;