-
Notifications
You must be signed in to change notification settings - Fork 41
/
gulpfile.babel.js
41 lines (36 loc) · 1.21 KB
/
gulpfile.babel.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
import gulp from 'gulp';
import uglify from 'gulp-uglify';
import grename from 'gulp-rename';
import source from 'vinyl-source-stream';
import buffer from 'vinyl-buffer';
import browserify from 'browserify';
import gbabel from 'gulp-babel';
import globalShim from 'browserify-global-shim';
let build_path = 'dst';
let transpile_path = 'lib';
gulp.task('transpile', () => {
return gulp.src('./src/**/*')
.pipe(gbabel({presets: ['es2015', 'react', 'stage-0']}))
.pipe(gulp.dest(transpile_path));
});
gulp.task('browserify', () => {
return browserify('./src/index.js', {standalone: 'Semantify'})
.transform('babelify', {presets: ['es2015', 'react', 'stage-0']})
.transform(globalShim.configure({
'react': 'React'
}))
.bundle()
.pipe(source('react-semantify.js'))
.pipe(gulp.dest(build_path))
.pipe(buffer())
.pipe(uglify())
.pipe(grename('react-semantify.min.js'))
.pipe(gulp.dest(build_path));
});
gulp.task('watch', (done) => {
gulp.watch('./src/**/*', gulp.series('build'));
done();
});
gulp.task('build', gulp.series('transpile', 'browserify'));
gulp.task('dev', gulp.series('build', 'watch'));
gulp.task('default', gulp.series('build'));