Skip to content

Commit

Permalink
Inline response generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
cweider committed Feb 20, 2012
1 parent bb10f02 commit b661ef5
Showing 1 changed file with 11 additions and 35 deletions.
46 changes: 11 additions & 35 deletions node/utils/Minify.js
Expand Up @@ -90,48 +90,24 @@ function _handle(req, res, jsFilename, jsFiles) {
res.writeHead(200, {});
res.end();
} else if (req.method == 'GET') {
if (settings.minify) {
respondMinified();
} else {
respondRaw();
}
res.writeHead(200, {});
tarCode(
jsFiles
, function (content) {
res.write(content);
}
, function (err) {
if(ERR(err)) return;
res.end();
}
);
} else {
res.writeHead(405, {'allow': 'HEAD, GET'});
res.end();
}
}
});
});

function respondMinified()
{
var result = undefined;
var values = [];
res.writeHead(200, {});
tarCode(
jsFiles
, function (content) {values.push(content)}
, function (err) {
if(ERR(err)) return;

result = values.join('');
res.write(result);
res.end();
}
);
}
//minifying is disabled, so put the files together in one file
function respondRaw()
{
res.writeHead(200, {});
tarCode(
jsFiles
, function (content) {res.write(content)}
, function (err) {
if(ERR(err)) return;
res.end();
});
}
}

// find all includes in ace.js and embed them.
Expand Down

0 comments on commit b661ef5

Please sign in to comment.