-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
61 lines (47 loc) · 1.16 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
//==============//
// DEPENDENCIES //
//==============//
// Local dependencies.
var pkg = require('./package.json');
// Node dependencies.
var fs = require('fs');
// Third-party dependencies.
var del = require('del');
var gulp = require('gulp');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var gutil = require('gulp-util');
var concat = require('gulp-concat');
var header = require('gulp-header');
//=========//
// GLOBALS //
//=========//
//=======//
// CLEAN //
//=======//
gulp.task('clean', function (callback) {
del(['dist'], callback);
});
//=======//
// BUILD //
//=======//
gulp.task('build', ['clean'], function () {
var headerContent = fs.readFileSync('src/header.js', 'utf8');
return gulp
.src([
'./src/module.js'
])
.pipe(concat('betsol-load-on-demand.js'))
.pipe(header(headerContent, { pkg : pkg } ))
.pipe(gulp.dest('dist'))
.pipe(uglify())
.pipe(header(headerContent, { pkg : pkg } ))
.pipe(rename('betsol-load-on-demand.min.js'))
.pipe(gulp.dest('dist'))
.on('error', gutil.log)
;
});
//==============//
// DEFAULT TASK //
//==============//
gulp.task('default', ['build']);