-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
33 lines (29 loc) · 939 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
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var browserify = require('browserify');
var babelify = require('babelify');
var insert = require('gulp-insert');
var fs = require('fs');
gulp.task('build', function() {
var preprocess = fs.readFileSync('./react_components/preprocess.jsx');
// participant.js
browserify('./react_components/participant.jsx')
.transform('babelify', {presets: ["es2015", "react"]})
.bundle()
.pipe(source('participant.js'))
.pipe(insert.prepend(preprocess))
.pipe(gulp.dest('./'));
// host.js
browserify('./react_components/host.jsx')
.transform('babelify', {presets: ["es2015", "react"]})
.bundle()
.pipe(source('host.js'))
.pipe(insert.prepend(preprocess))
.pipe(gulp.dest('./'));
});
gulp.task('watch', function() {
gulp.watch([
'./react_components/**/*.jsx',
], ['build']);
});
gulp.task('default', ['build', 'watch']);