mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
Compile and minimize code #82
This commit is contained in:
parent
0a0b3e8849
commit
6f288f00b5
8 changed files with 210 additions and 5 deletions
|
|
@ -47,6 +47,10 @@ function (http, nodeStatic, Api) {
|
||||||
fileServer.serveFile('./client.js', 200, {}, req, res);
|
fileServer.serveFile('./client.js', 200, {}, req, res);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case req.url == '/client.min.js':
|
||||||
|
fileServer.serveFile('./client.min.js', 200, {}, req, res);
|
||||||
|
break;
|
||||||
|
|
||||||
case req.url == '/require.js':
|
case req.url == '/require.js':
|
||||||
fileServer.serveFile('./node_modules/requirejs/require.js', 200, {}, req, res);
|
fileServer.serveFile('./node_modules/requirejs/require.js', 200, {}, req, res);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
2
app/Lib/Vendor/Screenfull.js
vendored
2
app/Lib/Vendor/Screenfull.js
vendored
|
|
@ -1,3 +1,3 @@
|
||||||
define(["/screenfull.js"], function() {
|
define(["screenfull"], function() {
|
||||||
return screenfull;
|
return screenfull;
|
||||||
});
|
});
|
||||||
2
app/Lib/Vendor/SocketIO.js
vendored
2
app/Lib/Vendor/SocketIO.js
vendored
|
|
@ -1,3 +1,3 @@
|
||||||
define(["/socket.io/socket.io.js"], function() {
|
define(["socketio"], function() {
|
||||||
return io;
|
return io;
|
||||||
});
|
});
|
||||||
13
build.js
Normal file
13
build.js
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
({
|
||||||
|
baseUrl: "app",
|
||||||
|
paths: {
|
||||||
|
"screenfull": "../node_modules/screenfull/dist/screenfull",
|
||||||
|
"socketio": "../node_modules/socket.io/node_modules/socket.io-client/dist/socket.io"
|
||||||
|
},
|
||||||
|
name: "../client",
|
||||||
|
out: "client.min.js",
|
||||||
|
onBuildRead: function (moduleName, path, contents) {
|
||||||
|
var contents = contents.replace(/\" \+ GLOBALS.context \+ \"/g, "Client");
|
||||||
|
return contents;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
@ -3,7 +3,11 @@ GLOBALS = { context: "Client" };
|
||||||
requirejs.config({
|
requirejs.config({
|
||||||
baseUrl: 'app',
|
baseUrl: 'app',
|
||||||
deps: ['Lib/Utilities/Extensions'],
|
deps: ['Lib/Utilities/Extensions'],
|
||||||
waitSeconds: 0
|
waitSeconds: 0,
|
||||||
|
paths: {
|
||||||
|
screenfull: "/screenfull",
|
||||||
|
socketio: "/socket.io/socket.io"
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!Chuck) var Chuck = {};
|
if(!Chuck) var Chuck = {};
|
||||||
|
|
|
||||||
181
client.min.js
vendored
Normal file
181
client.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -25,5 +25,8 @@
|
||||||
"optionalDependencies": {},
|
"optionalDependencies": {},
|
||||||
"engine": "node >= 0.8.4",
|
"engine": "node >= 0.8.4",
|
||||||
"config": { "port": "1234" },
|
"config": { "port": "1234" },
|
||||||
"private": true
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"prestart": "node_modules/requirejs/bin/r.js -o build.js optimize=none > /dev/null && echo '\\033[1;32mcompiled.\\033[0m'"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,6 @@
|
||||||
<canvas id="canvas"></canvas>
|
<canvas id="canvas"></canvas>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
<script data-main="client" src="require.js"></script>
|
<script data-main="client.min" src="require.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue