-
Notifications
You must be signed in to change notification settings - Fork 147
/
build.data.js
55 lines (44 loc) · 1.41 KB
/
build.data.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
//build 配置文件
module.exports = {
root: "../",
noStore: true,
concat: {
title: "文件合并",
dir: "js",
list: [
{
src: ["Q.js", "Q.Uploader.js", "Q.Uploader.slice.js", "Q.Uploader.UI.File.js"],
dest: "/Q.Uploader.file.all.js"
},
{
src: ["Q.js", "Q.Uploader.js", "Q.Uploader.UI.Image.js"],
dest: "/Q.Uploader.image.all.js"
}
],
replace: [
//移除\r字符
[/\r/g, ""],
//移除VS引用
[/\/\/\/\s*<reference path="[^"]*" \/>\n/gi, ""]
]
},
cmd: [
{
title: "压缩js",
//cmd: "java -jar D:\\tools\\compiler.jar --js=%f.fullname% --js_output_file=%f.dest%",
cmd: "uglifyjs %f.fullname% -o %f.dest% -c -m",
output: "dist",
match: ["*.js", "js/*.js"],
replace: [
//去掉文件头部压缩工具可能保留的注释
[/^\/\*([^~]|~)*?\*\//, ""]
],
//可针对单一的文件配置 before、after,def 表示默认
before: [{
"def": "//[email protected]\n//build:%NOW%\n",
"spark-md5.js": "//spark-md5 v2.0.2 https://github.com/satazor/js-spark-md5\n//build:%NOW%\n"
}]
}
],
run: ["concat", "cmd"]
};