forked from seatgeek/react-infinite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
44 lines (39 loc) · 1.24 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
var gulp = require('gulp'),
given = require('gulp-if'),
jsx = require('gulp-react'),
reactify = require('reactify'),
buffer = require('vinyl-buffer'),
minifyjs = require('gulp-uglify'),
browserify = require('browserify'),
sourcemaps = require('gulp-sourcemaps'),
browserifyShim = require('browserify-shim'),
sourcestream = require('vinyl-source-stream');
var args = require('yargs').alias('P', 'production')
.alias('D', 'development')
.alias('E', 'example').argv,
production = args.production,
development = args.development,
example = args.example;
gulp.task('build', function() {
var b = browserify({
entries: './src/react-infinite.jsx',
standalone: 'Infinite'
})
.transform(reactify, {
es6: true
})
.exclude('react')
.bundle()
.pipe(sourcestream('react-infinite.' + (production ? 'min.' : '') + 'js'))
.pipe(buffer())
.pipe(given(development, sourcemaps.init()))
.pipe(given(production, minifyjs()))
.pipe(given(development, sourcemaps.write('.')))
.pipe(gulp.dest('dist'));
if (example) {
gulp.src('./examples/index.jsx')
.pipe(jsx())
.pipe(gulp.dest('examples'))
}
});
gulp.task('default', ['build']);