Always use the JS assets processed by Minify.

This allows the preprocessing that will restrict scope of files to be done once in Minify.
pull/343/head
Chad Weider 2012-01-17 01:22:23 -08:00
parent 2b5d7a0048
commit 9e16b9a575
2 changed files with 13 additions and 1 deletions

View File

@ -52,10 +52,21 @@ exports.minifyJS = function(req, res, next)
var jsFiles = undefined; var jsFiles = undefined;
if (Object.prototype.hasOwnProperty.call(tar, jsFilename)) { if (Object.prototype.hasOwnProperty.call(tar, jsFilename)) {
jsFiles = tar[jsFilename]; jsFiles = tar[jsFilename];
_handle(req, res, jsFilename, jsFiles)
} else { } else {
return next(); // Not in tar list, but try anyways, if it fails, pass to `next`.
jsFiles = [jsFilename];
fs.stat(JS_DIR + jsFilename, function (error, stats) {
if (error || !stats.isFile()) {
next();
} else {
_handle(req, res, jsFilename, jsFiles);
}
});
} }
}
function _handle(req, res, jsFilename, jsFiles) {
res.header("Content-Type","text/javascript"); res.header("Content-Type","text/javascript");
//minifying is enabled //minifying is enabled

View File

@ -230,6 +230,7 @@ function Ace2Editor()
} }
for (var i = 0, ii = remoteFiles.length; i < ii; i++) { for (var i = 0, ii = remoteFiles.length; i < ii; i++) {
var file = remoteFiles[i]; var file = remoteFiles[i];
file = file.replace(/^\.\.\/static\/js\//, '../minified/');
buffer.push('<script type="application/javascript" src="' + file + '"><\/script>'); buffer.push('<script type="application/javascript" src="' + file + '"><\/script>');
} }
} }