diff --git a/lib/server.js b/lib/server.js index 8b490c42..2f6a9d66 100644 --- a/lib/server.js +++ b/lib/server.js @@ -170,7 +170,7 @@ lRet = Util.exec(Route, lData); if (!lRet) - lRet = combine(lPath, pRes); + lRet = combine(lData); if (!lRet) { lName = lData.name; @@ -204,19 +204,37 @@ } } - function combine(path, res) { - var names, + function combine(params) { + var names, i, n, name, minName, + config = main.config, dir = DIR, - COMBINE = '/combine', + p = params, + path = params.name, + COMBINE = '/combine/', isCombine = Util.isContainStrAtBegin(path, COMBINE); if (isCombine) { path = Util.removeStrOneTime(path, COMBINE); names = path.split(':'); - console.log(names, DIR); - files.readPipe(names, dir, res, function(error) { - Util.log(error); - main.sendError(res); + n = names.length; + + if (config.minify) + for (i = 0; i < n; i++) { + name = Path.join(DIR, names[i]); + minName = Minify.getName(name); + if (name !== minName) { + names[i] = minName; + dir = ''; + } + } + + console.log(names); + + files.readPipe(names, dir, p.response, function(error) { + if (error) { + Util.log(error); + main.sendError(params, error); + } }); }