forked from larrymyers/react-mini-router
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
34 lines (30 loc) · 914 Bytes
/
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
var gulp = require('gulp'),
del = require('del'),
changed = require('gulp-changed'),
babel = require('gulp-babel'),
source = require('vinyl-source-stream'),
nodemon = require('gulp-nodemon');
gulp.task('clean', function(done) {
del([
'app/components/*.js',
'public/js/app.js'
], done);
});
gulp.task('react', function() {
return gulp.src('./app/components/*.jsx')
.pipe(changed('./app/components/', { extension: '.js' }))
.pipe(babel())
.pipe(gulp.dest('./app/components/'));
});
gulp.task('watch', function() {
gulp.watch(['app/components/**/*.jsx'], ['react'])
.on('change', function(event) {
console.log('React Transform: ' + event.path + ' (' + event.type + ')');
});
});
gulp.task('serve', ['react', 'watch'], function() {
nodemon({
script: 'server.js',
watch: ['app']
});
});