add browser build - closes #17

This commit is contained in:
Sebastian McKenzie
2014-10-09 15:24:57 +11:00
parent 2a2b2c427a
commit 439b378ebf
5 changed files with 35 additions and 13 deletions

View File

@@ -201,11 +201,11 @@ exports.repeat = function (width, cha) {
return new Array(width + 1).join(cha);
};
var templatesCacheLoc = __dirname + "/../../templates.json";
try {
exports.templates = require("../../templates.json");
} catch (err) {
if (err.code !== "MODULE_NOT_FOUND") throw err;
if (fs.existsSync(templatesCacheLoc)) {
exports.templates = require(templatesCacheLoc);
} else {
exports.templates = {};
var templatesLoc = __dirname + "/templates";