Merge pull request #359 from booo/master

close issue #281?
This commit is contained in:
Peter 'Pita' Martischka 2012-01-25 13:58:03 -08:00
commit a408a2d43b
2 changed files with 8 additions and 18 deletions

View File

@ -28,7 +28,7 @@ var jsp = require("uglify-js").parser;
var pro = require("uglify-js").uglify; var pro = require("uglify-js").uglify;
var path = require('path'); var path = require('path');
var Buffer = require('buffer').Buffer; var Buffer = require('buffer').Buffer;
var gzip = require('gzip'); var zlib = require('zlib');
var RequireKernel = require('require-kernel'); var RequireKernel = require('require-kernel');
var server = require('../server'); var server = require('../server');
var os = require('os'); var os = require('os');
@ -233,23 +233,14 @@ function _handle(req, res, jsFilename, jsFiles) {
//write the results compressed in a file //write the results compressed in a file
function(callback) function(callback)
{ {
//spawn a gzip process if we're on a unix system zlib.gzip(result, function(err, compressedResult){
if(os.type().indexOf("Windows") == -1) //weird gzip bug that returns 0 instead of null if everything is ok
{ err = err === 0 ? null : err;
gzip(result, 9, function(err, compressedResult){
//weird gzip bug that returns 0 instead of null if everything is ok
err = err === 0 ? null : err;
if(ERR(err, callback)) return; if(ERR(err, callback)) return;
fs.writeFile(CACHE_DIR + "minified_" + jsFilename + ".gz", compressedResult, callback); fs.writeFile(CACHE_DIR + "minified_" + jsFilename + ".gz", compressedResult, callback);
}); });
}
//skip this step on windows
else
{
callback();
}
} }
],callback); ],callback);
} }

View File

@ -18,7 +18,6 @@
"express" : "2.5.0", "express" : "2.5.0",
"clean-css" : "0.2.4", "clean-css" : "0.2.4",
"uglify-js" : "1.1.1", "uglify-js" : "1.1.1",
"gzip" : "0.1.0",
"formidable" : "1.0.7", "formidable" : "1.0.7",
"log4js" : "0.3.9", "log4js" : "0.3.9",
"jsdom-nocontextifiy" : "0.2.10", "jsdom-nocontextifiy" : "0.2.10",