forked from jupiterjs/jquerymx
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.js
55 lines (50 loc) · 1.71 KB
/
build.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
load('steal/file/file.js')
var i, fileName, cmd,
plugins = [
"class",
"controller",
"event/default",
"event/destroyed",
"event/drag",
{
plugin: "event/drag/limit",
exclude: ["jquery/lang/vector/vector.js", "jquery/event/livehack/livehack.js", "jquery/event/drag/drag.js"]},
{
plugin: "event/drag/scroll",
exclude: ["jquery/dom/within/within.js", "jquery/dom/compare/compare.js", "jquery/event/drop/drop.js","jquery/lang/vector/vector.js", "jquery/event/livehack/livehack.js", "jquery/event/drag/drag.js"]},
{
plugin: "event/drop",
exclude: ["jquery/lang/vector/vector.js", "jquery/event/livehack/livehack.js", "jquery/event/drag/drag.js"]},
"event/hover",
"model",
"view/ejs",
"dom/closest",
"dom/compare",
"dom/dimensions",
"dom/fixture",
"dom/form_params",
"dom/within"
]
var plugin, exclude, fileDest;
for(i=0; i<plugins.length; i++){
plugin = plugins[i];
exclude = [];
if (typeof plugin != "string") {
plugin = plugins[i].plugin;
exclude = plugins[i].exclude;
}
fileName = "jquery."+plugin.replace(/\//g, ".").replace(/dom\./, "")+".js";
fileDest = "jquery/dist/"+fileName
cmd = "js steal/scripts/pluginify.js jquery/"+plugin+" -destination "+fileDest;
if(exclude.length)
cmd += " -exclude "+exclude;
runCommand( "cmd", "/C", cmd)
// compress
var outBaos = new java.io.ByteArrayOutputStream();
var output = new java.io.PrintStream(outBaos);
runCommand("java", "-jar", "steal/rhino/compiler.jar", "--compilation_level",
"SIMPLE_OPTIMIZATIONS", "--warning_level","QUIET", "--js", fileDest, {output: output});
var minFileDest = fileDest.replace(".js", ".min.js")
new steal.File(minFileDest).save(outBaos.toString());
print("***"+fileName+" pluginified and compressed")
}