forked from schmich/instascan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
33 lines (29 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
var gulp = require('gulp');
var rename = require('gulp-rename');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var uglify = require('gulp-uglify');
var babelify = require('babelify');
gulp.task('default', ['build', 'watch']);
gulp.task('dist', function () {
return browserify('./export.js', { noParse: [require.resolve('./src/zxing')] })
.transform(babelify, { ignore: /zxing\.js$/i, presets: ['es2015'] })
.bundle()
.pipe(source('instascan.js'))
.pipe(buffer())
.pipe(uglify())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('./dist/'));
});
gulp.task('watch', function () {
gulp.watch('./src/*.js', ['build']);
gulp.watch('./*.js', ['build']);
});
gulp.task('build', function () {
return browserify('./export.js', { noParse: [require.resolve('./src/zxing')] })
.transform(babelify, { ignore: /zxing\.js$/i, presets: ['es2015'] })
.bundle()
.pipe(source('instascan.js'))
.pipe(gulp.dest('./dist/'));
});