diff --git a/node/utils/Minify.js b/node/utils/Minify.js index 1a214fb92..d3c8831af 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -52,10 +52,21 @@ exports.minifyJS = function(req, res, next) var jsFiles = undefined; if (Object.prototype.hasOwnProperty.call(tar, jsFilename)) { jsFiles = tar[jsFilename]; + _handle(req, res, jsFilename, jsFiles) } 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"); //minifying is enabled diff --git a/static/js/ace.js b/static/js/ace.js index 3f52d315f..4735aaae7 100644 --- a/static/js/ace.js +++ b/static/js/ace.js @@ -230,6 +230,7 @@ function Ace2Editor() } for (var i = 0, ii = remoteFiles.length; i < ii; i++) { var file = remoteFiles[i]; + file = file.replace(/^\.\.\/static\/js\//, '../minified/'); buffer.push('