forked from Houfeng/iweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGulpfile.js
49 lines (44 loc) · 1.3 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
var gulp = require("gulp");
var uglify = require("gulp-uglify");
var cssMinify = require("gulp-minify-css");
var htmlMin = require("gulp-htmlmin");
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var header = require('gulp-header');
var replace = require('gulp-replace');
var del = require('del');
var pkg = require("./package.json");
var banner = ['/**',
' * <%= rawName %>.js',
' * <%= description %>',
' * @version v<%= version %>',
' * @link <%= homepage %>',
' * @license <%= license %>',
' * @author <%= author.name %>',
' * @email <%= author.email %>',
' */',
''
].join('\r\n');
//清理
gulp.task('clear', function(cb) {
del(['./lib/common/web/target-script.all.js',
'./lib/common/web/target-script.min.js'
], cb);
});
//构建
gulp.task('build', ["clear"], function() {
//target-script.js
gulp.src(["./lib/common/web/socket-io-client.js",
"./lib/common/web/target-script.js"
])
.pipe(concat("target-script-all.js"))
.pipe(header(banner, pkg))
.pipe(gulp.dest("./lib/common/web/"))
.pipe(uglify())
.pipe(header(banner, pkg))
.pipe(rename("target-script-min.js"))
.pipe(gulp.dest("./lib/common/web/"));
});
//默认任务
gulp.task('default', ["build"]);
//end