Skip to content

Instantly share code, notes, and snippets.

@cweider
Created January 16, 2012 00:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cweider/1618182 to your computer and use it in GitHub Desktop.
Save cweider/1618182 to your computer and use it in GitHub Desktop.
Simplified Patch
commit e42f039941e83fa54b615a472f244d3f971c8330
Author: booo <borgers@mi.fu-berlin.de>
Date: Wed Dec 21 18:18:22 2011 +0100
fix issue #281; remove white spaces
diff --git a/node/utils/Minify.js b/node/utils/Minify.js
index fd1dd07..70ccc15 100644
--- a/node/utils/Minify.js
+++ b/node/utils/Minify.js
@@ -28,7 +28,7 @@ var jsp = require("uglify-js").parser;
var pro = require("uglify-js").uglify;
var path = require('path');
var Buffer = require('buffer').Buffer;
-var gzip = require('gzip');
+var zlib = require('zlib');
var server = require('../server');
var os = require('os');
@@ -233,24 +233,13 @@ exports.minifyJS = function(req, res, jsFilename)
//write the results compressed in a file
function(callback)
{
- //spawn a gzip process if we're on a unix system
- if(os.type().indexOf("Windows") == -1)
- {
- gzip(result, 9, function(err, compressedResult){
- //weird gzip bug that returns 0 instead of null if everything is ok
- err = err === 0 ? null : err;
-
+ //gzip file if we're on a unix system
+ zlib.gzip(result, function(err, compressedResult){
if(ERR(err, callback)) return;
fs.writeFile("../var/minified_" + jsFilename + ".gz", compressedResult, callback);
});
}
- //skip this step on windows
- else
- {
- callback();
- }
- }
],callback);
}
], function(err)
diff --git a/package.json b/package.json
index 0a73b92..900b55c 100644
--- a/package.json
+++ b/package.json
@@ -17,7 +17,6 @@
"express" : "2.5.0",
"clean-css" : "0.2.4",
"uglify-js" : "1.1.1",
- "gzip" : "0.1.0",
"formidable" : "1.0.7",
"log4js" : "0.3.9",
"jsdom-nocontextifiy" : "0.2.10",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment