-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
67 lines (60 loc) · 1.48 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
const gulp = require('gulp');
const concat = require('gulp-concat');
const serve = require('gulp-serve');
const babel = require('gulp-babel');
const del = require('del');
const uglify = require('gulp-uglify');
const rename = require('gulp-rename');
gulp.task('serve', serve({
root: ['./'],
port: 9090,
https: true
}));
gulp.task('default', ['compress'])
gulp.task('compress', ['scripts'], function() {
return gulp.src('dist/qrcode.js')
.pipe(uglify())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('dist'));
});
gulp.task('scripts', ['es6'], () => {
return gulp.src([
'lib/before.js',
'lib/grid.js',
'lib/version.js',
'lib/perspectiveTransform.js',
'lib/detector.js',
'lib/formatinf.js',
'lib/errorlevel.js',
'lib/bitmatrix.js',
'lib/dataBlock.js',
'lib/bitMatrixParser.js',
'lib/datamask.js',
'lib/rsdecoder.js',
'lib/gf256poly.js',
'lib/gf256.js',
'lib/decoder.js',
'lib/qrcode.js',
'lib/findpat.js',
'lib/alignmentPattern.js',
'lib/alignmentPatternFinder.js',
'lib/dataBlockReader.js',
'lib/adapter.js',
'.tmp/qr-code.js',
'lib/after.js'
])
.pipe(concat('qrcode.js'))
.pipe(gulp.dest('./dist/'));
});
gulp.task('es6', () => {
return gulp.src('src/qr-code.js')
.pipe(babel({ presets: ['es2015'] }))
.pipe(gulp.dest('.tmp'));
});
gulp.task('clean', function() {
return del([
'.tmp', 'dist', 'doc'
]);
});