diff --git a/lib/server/beautify.js b/lib/server/beautify.js index 594ca23e..a3b6203d 100644 --- a/lib/server/beautify.js +++ b/lib/server/beautify.js @@ -13,6 +13,9 @@ HOME_UNIX = process.env.HOME, HOME = (HOME_UNIX || HOME_WIN) + '/', + EXT = ['js', 'css', 'html'], + ERROR_MSG = 'File type "{{ ext }}" not supported.', + ERROR_MSG_INST = 'Beautify not installed', ConfigPath = DIR + 'json/beautify.json', ConfigHome = HOME + '.beautify.json', @@ -21,17 +24,18 @@ tryRequire(ConfigPath, {log: true}) || {}; module.exports = function(name, callback) { - var EXT = ['js', 'css', 'html'], - ext = path + var ext = path .extname(name) .slice(1), is = ~EXT.indexOf(ext); if (!beautify) - callback(Error('Beautify not installed')); + callback(Error(ERROR_MSG_INST)); else if (!is) - callback(Error('Supported file types: ' + EXT.join(', '))); + callback(Error(Util.render(ERROR_MSG, { + ext : ext + }))); else fs.readFile(name, 'utf8', function(error, data) { var result;