forked from LiangCY/questionnaire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
32 lines (28 loc) · 883 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
var gulp = require("gulp");
var browserify = require("browserify");
var source = require('vinyl-source-stream');
var streamify = require('gulp-streamify');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var nodemon = require('gulp-nodemon');
gulp.task('jsx', function () {
browserify(['./public/app/src/app.js'])
.transform('babelify', {presets: ["react"]})
.bundle()
.pipe(source('index.js'))
.pipe(streamify(uglify()))
.pipe(rename('app.js'))
.pipe(gulp.dest('./public/app/dist'));
});
gulp.task('watch', function () {
gulp.watch(['public/app/src/**/*'], ['jsx']);
});
gulp.task('serve', function () {
nodemon({
script: 'app.js',
ext: 'js',
ignore: ['public/**/*'],
env: {'NODE_ENV': 'development'}
})
});
gulp.task('default', ['watch', 'jsx', 'serve']);