-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
61 lines (55 loc) · 1.41 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
const gulp = require('gulp');
const uglify = require('gulp-uglify');
const rename = require('gulp-rename');
const header = require('gulp-header');
const today = new Date().toLocaleDateString();
const pkg = require('./package.json');
const banner = [
'/*!',
' * JQL (JSON Query Language)',
' * <%= pkg.description %>',
' * @version : <%= pkg.version %>',
' * @author : <%= pkg.author %>',
' * @repository : <%= pkg.repository.url %>',
' * @built : <%= today %>',
' * @license : <%= pkg.license %>',
' */',
''
].join('\n');
gulp.task('build', function (done) {
// Package info
// Gulp it!
gulp.src('./src/*.js')
// Full
.pipe(header(banner, { pkg : pkg, today: today } ))
.pipe(gulp.dest('./dist'))
.on('end', function(){
console.log(`[${today}] [Gulp] JQL Build - Full \t✅`);
done();
})
// Minified
.pipe(uglify({
mangle: {
toplevel: true
},
compress: {
sequences: true,
dead_code: true,
conditionals: true,
booleans: true,
unused: true,
if_return: true,
join_vars: true,
drop_console: false
}
}))
.pipe(header(banner, { pkg : pkg, today: today } ))
.pipe(rename("JQL.min.js"))
.pipe(gulp.dest('./dist'))
.on('end', function(){
console.log(`[${today}] [Gulp] JQL Build - Minify \t✅`);
done();
});
});
gulp.watch('./src/*.js', gulp.series('build'))
gulp.task('default', gulp.series('build'));