-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
53 lines (47 loc) · 1.39 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
var gulp = require('gulp');
var inject = require('gulp-inject');
var mainBowerFiles = require('main-bower-files');
var debug = require('gulp-debug');
var server = require('gulp-server-livereload');
var react = require('gulp-react');
gulp.task('index', function () {
var bowerFiles = mainBowerFiles({
"overrides": {
"bootstrap": {
"main": [
"dist/css/bootstrap.css",
"dist/js/bootstrap.js"
],
}
}
});
return gulp.src('./index.html')
.pipe(inject(gulp.src(bowerFiles, {read: false}), {name: 'bower', relative: true}))
.pipe(gulp.dest('./'));
});
gulp.task('precompile-jsx', function () {
return gulp.src('src/js/**/*.jsx')
.pipe(react({harmony: true}))
.pipe(gulp.dest('dist'));
});
gulp.task('precompile-specs', function () {
return gulp.src('spec/**/*_spec.jsx')
.pipe(react({harmony: true}))
.pipe(gulp.dest('tests'));
});
gulp.task('watch', function() {
gulp.watch('spec/**/*_spec.jsx', function() {
gulp.run('precompile-specs');
});
gulp.watch('src/js/**/*.jsx', function() {
gulp.run('precompile-jsx');
});
});
gulp.task('serve', ['index', 'precompile-jsx', 'precompile-specs', 'watch'], function() {
gulp.src('.')
.pipe(server({
livereload: true,
defaultFile: "index.html",
open: true
}));
});