-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
45 lines (41 loc) · 1 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
var gulp = require('gulp'),
concat = require('gulp-concat'),
react = require('gulp-react'),
uglify = require('gulp-uglify'),
minifyCss = require('gulp-minify-css'),
rename = require('gulp-rename');
var files = [
'./src/Tree/intro.js',
'./src/Tree/Treenode.js',
'./src/Tree/Treeview.js',
'./src/Tree/outro.js'
];
/**
* Precompile jsx
*/
gulp.task('jsx', function () {
return gulp.src('./src/**/*.jsx')
.pipe(react())
.pipe(gulp.dest('./src/'));
});
/**
* Concatnate js files
*/
gulp.task('concat', ['jsx'], function () {
var intro = gulp.src(files)
.pipe(concat('react-tree.js'));
return intro.pipe(gulp.dest('./build/'));
});
/**
* minify concatnated files
*/
gulp.task('minify', ['concat'], function () {
gulp.src('./build/*.css')
.pipe(minifyCss())
.pipe(rename({extname: '.min.css'}))
.pipe(gulp.dest('./build/'));
gulp.src('./build/*.js')
.pipe(uglify())
.pipe(rename({extname: '.min.js'}))
.pipe(gulp.dest('./build/'));
});