diff options
Diffstat (limited to 'js/bin/HttpServer.js')
-rw-r--r-- | js/bin/HttpServer.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/js/bin/HttpServer.js b/js/bin/HttpServer.js index cde3cdec8cb..9e070937522 100644 --- a/js/bin/HttpServer.js +++ b/js/bin/HttpServer.js @@ -47,6 +47,12 @@ function Init() "/lib/Glacier2.js", "/lib/Glacier2.min.js", "/lib/IceStorm.js", "/lib/IceStorm.min.js", "/lib/IceGrid.js", "/lib/IceGrid.min.js",]; + + var libraryMaps = libraries.map( + function(f) + { + return f + ".map"; + }); var HttpServer = function(host, ports) { @@ -60,6 +66,7 @@ function Init() var filePath; var iceLib = libraries.indexOf(req.url.pathname) !== -1; + var iceLibMap = libraryMaps.indexOf(req.url.pathname) !== -1; // // If ICE_HOME has been set resolve Ice libraries paths into ICE_HOME. // @@ -69,9 +76,16 @@ function Init() // If OPTIMIZE is set resolve Ice libraries to the corresponding minified // versions. // - if(process.env.OPTIMIZE == "yes" && iceLib && filePath.substr(-7) !== ".min.js") + if(process.env.OPTIMIZE == "yes") { - filePath = filePath.replace(".js", ".min.js"); + if(iceLib && filePath.substr(-7) !== ".min.js") + { + filePath = filePath.replace(".js", ".min.js"); + } + else if(iceLibMap && filePath.substr(-11) !== ".min.js.map") + { + filePath = filePath.replace(".js.map", ".min.js.map"); + } } var ext = path.extname(filePath).slice(1); @@ -80,7 +94,7 @@ function Init() // When the browser ask for a .js or .css file and it has support for gzip content // check if a gzip version (.js.gz or .css.gz) of the file exists and use that instead. // - if((ext == "js" || ext == "css") && req.headers["accept-encoding"].indexOf("gzip") !== -1) + if((ext == "js" || ext == "css" || ext == "map") && req.headers["accept-encoding"].indexOf("gzip") !== -1) { fs.stat(filePath + ".gz", function(err, stats) |