-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
49 lines (48 loc) · 1.22 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
const Gulp = require('gulp');
const GulpUglify = require('gulp-uglify');
const GulpConcat = require('gulp-concat');
const GulpUtil = require('./plugins/gulp-util');
//
const DistPath = './dist';
Gulp.task('utils', function()
{
var version = GulpUtil.getProcessArgs();
if(version == null)
{
throw new Error('版本号不能为空');
}
var fileName = 'utils-' + version + '.min.js';
Gulp.src('src/*.js').pipe(GulpConcat(fileName)).pipe(GulpUglify()).pipe(Gulp.dest(DistPath));
console.log('输出完成:' + fileName);
});
function parseJsFile(name)
{
var version = GulpUtil.getProcessArgs();
if(version == null)
{
throw new Error('版本号不能为空');
}
var fileName = name + '-' + version + '.min.js';
Gulp.src('src/' + name + '.js').pipe(GulpConcat(fileName)).pipe(GulpUglify()).pipe(Gulp.dest(DistPath));
console.log('输出完成:' + fileName);
}
Gulp.task('href', function()
{
parseJsFile('href');
});
Gulp.task('timer', function()
{
parseJsFile('timer');
});
Gulp.task('unixtime', function()
{
parseJsFile('unixtime');
});
Gulp.task('urlutil', function()
{
parseJsFile('urlutil');
});
Gulp.task('validate', function()
{
parseJsFile('validate');
});