-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
43 lines (35 loc) · 1.08 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
var gulp = require('gulp'),
gulp_clean = require('gulp-clean'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
sourcemaps = require("gulp-sourcemaps");
var folder = {
src: 'src',
dist: 'dist'
};
var khoaiScripts = [
'src/khoai.js',
'src/util.js'
];
gulp.task('clean-dist-folder', function () {
return gulp.src(folder.dist, {read: false})
.pipe(gulp_clean());
});
gulp.task('khoai_js__concat', ['clean-dist-folder'], function () {
return gulp.src(khoaiScripts)
.pipe(sourcemaps.init())
.pipe(concat('khoai.js'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(folder.dist));
});
gulp.task('khoai_js__uglify', ['khoai_js__concat'], function () {
return gulp.src(folder.dist + '/khoai.js')
.pipe(rename({suffix: '.min'}))
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(folder.dist));
});
gulp.task('khoai_js', ['khoai_js__concat', 'khoai_js__uglify']);
gulp.task('default', ['khoai_js']);