-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
57 lines (44 loc) · 1.33 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
var gulp = require('gulp');
var ts = require('gulp-typescript');
var browserify = require('browserify');
var source = require("vinyl-source-stream");
var reactify = require('reactify');
gulp.task('default', ['ts', 'bundle', 'move']);
gulp.task('ts', function() {
var tsResult = gulp
.src('frontend/**/*.ts')
.pipe(ts({
noEmitOnError : true,
module: 'commonjs',
outDir: 'bin'
}));
return tsResult.js.pipe(gulp.dest('./bin'));
});
gulp.task('move', ['move-component', 'move-statics']);
gulp.task('move-component', function(cb) {
// move components
var jsx = gulp.src('frontend/component/*.jsx')
.pipe(gulp.dest('./bin/component'));
jsx.on('end', function() {
cb();
});
});
gulp.task('move-statics', function(cb) {
// move static
var stat = gulp.src('frontend/static/**/*')
.pipe(gulp.dest('./bin/static'));
stat.on('end', function() {
cb();
});
});
gulp.task('bundle', ['move'], function(cb) {
var b = browserify();
b.transform(reactify); // use the reactify transform
b.add('./bin/main.js');
b.bundle()
.pipe(source('main.js'))
.pipe(gulp.dest('./bin/static/js'));
b.on('end', function() {
cb();
});
});