forked from qmlweb/qmlweb-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
47 lines (41 loc) · 1.39 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
const gulp = require('gulp');
const concat = require('gulp-concat');
const rename = require('gulp-rename');
const changed = require('gulp-changed');
const order = require('gulp-order');
const uglify = require('gulp-uglify');
const sourcemaps = require('gulp-sourcemaps');
const iife = require('gulp-iife');
const sources = [
'src/**/*.js'
];
gulp.task('build-dev', function() {
return gulp.src(sources)
.pipe(order(sources, { base: __dirname }))
.pipe(sourcemaps.init())
.pipe(concat('qmlweb.parser.js'))
.pipe(iife({
useStrict: false,
params: ['exports'],
args: ['typeof exports !== \'undefined\' ? exports : window']
}))
.pipe(changed('./lib'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./lib'));
});
gulp.task('build', ['build-dev'], function() {
return gulp.src('./lib/qmlweb.parser.js')
.pipe(rename('qmlweb.parser.min.js'))
.pipe(changed('./lib'))
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(uglify())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./lib'));
});
gulp.task('watch', ['build'], function() {
gulp.watch(sources, ['build']);
});
gulp.task('watch-dev', ['build-dev'], function() {
gulp.watch(sources, ['build-dev']);
});
gulp.task('default', ['watch']);