Skip to content
Browse files

Add gzip to the build script

  • Loading branch information...
1 parent e1d8740 commit 5bfd0048066c3c84a7afb5ca30ec60a6746ad557 Matt Lantz committed Oct 31, 2012
Showing with 16 additions and 6 deletions.
  1. +16 −6 Jakefile
View
22 Jakefile
@@ -7,18 +7,28 @@ task("build", [], function () {
console.log("building Alice.js ...");
var fs = require('fs'),
+ zlib = require('zlib'),
+ gzip = zlib.createGzip(),
+ ginp = "",
+ gout = '',
childProcess = require('child_process'),
output = "";
-
console.log(" - including alice.core.js");
output += fs.readFileSync("src/alice.core.js", "utf-8");
console.log(" - including alice.plugins.cheshire.js");
output += fs.readFileSync("src/alice.plugins.cheshire.js", "utf-8");
console.log(" - including alice.plugins.caterpillar.js");
output += fs.readFileSync("src/alice.plugins.caterpillar.js", "utf-8");
- console.log("writing: js/alice.js");
- fs.writeFileSync("js/alice.js", output);
- console.log("minifying: js/alice-min.js");
- childProcess.exec("uglifyjs js/alice.js > js/alice-min.js", complete);
-}, true);
+ console.log("writing: build/alice.js");
+ fs.writeFileSync("build/alice.js", output);
+ console.log("minifying: build/alice.min.js");
+ childProcess.exec("uglifyjs build/alice.js > build/alice.min.js", complete);
+ console.log("gzipping: build/alice.min.js");
+ setTimeout(function(){
+ ginp = fs.createReadStream('build/alice.min.js');
+ gout = fs.createWriteStream('build/alice.min.js.gz');
+ ginp.pipe(gzip).pipe(gout);
+ console.log("Build Complete.");
+ }, 2000);
+}, true);

0 comments on commit 5bfd004

Please sign in to comment.
Something went wrong with that request. Please try again.