-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
42 lines (37 loc) · 1.02 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
var gulp = require('gulp');
var babel = require('gulp-babel');
var browserify = require('gulp-browserify');
var clean = require('gulp-clean');
var concat = require('gulp-concat');
var plumber = require('gulp-plumber');
var uglify = require('gulp-uglify');
gulp.task('clean', function () {
return gulp
.src('dist')
.pipe(clean());
});
gulp.task('build-node', function () {
return gulp
.src('src/**/*.js')
.pipe(plumber())
.pipe(babel({ presets: ['react', 'es2015', 'stage-0'] }))
.pipe(gulp.dest('dist'));
});
gulp.task('build-browser', ['build-node'], function () {
return gulp
.src('dist/index.js')
.pipe(plumber())
.pipe(browserify({
insertGlobals: false,
sourceType: 'module',
external: ['react', 'react-redux'],
standalone: 'ReduxSetState',
}))
.pipe(concat('redux-setstate.min.js'))
.pipe(uglify({ mangle: true }))
.pipe(gulp.dest('.'));
});
gulp.task('build', ['build-browser']);
gulp.task('watch', function () {
gulp.watch('src/**/*', ['build']);
});