reagent/bin/gen-site.js

38 lines
843 B
JavaScript
Raw Normal View History

2014-01-05 10:16:01 +00:00
var cljsLoad = require("./cljs-load");
2014-01-05 10:16:01 +00:00
var srcFile = "outsite/public/js/main.js";
var outputDirectory = "outsite/public/js/out/";
var moduleName = "devsetup";
2014-01-09 13:37:11 +00:00
var beep = "\u0007";
2014-01-05 10:16:01 +00:00
2014-12-09 06:30:57 +00:00
if (typeof location === "undefined") {
// figwheel wants js/location to exist, even if it doesn't run,
// for some reason
global.location = {};
}
var gensite = function () {
console.log("Loading " + srcFile);
var optNone = cljsLoad.load(srcFile, outputDirectory, moduleName);
sitetools.genpages({"opt-none": optNone});
2014-01-19 11:13:19 +00:00
}
var compileFail = function () {
var msg = process.argv[process.argv.length - 1];
if (msg && msg.match(/failed/)) {
console.log("Compilation failed" + beep);
2014-01-20 08:40:56 +00:00
return true;
}
2014-01-20 08:40:56 +00:00
};
2014-01-05 10:16:01 +00:00
if (!compileFail()) {
try {
gensite();
} catch (e) {
console.log(e + beep);
console.error(e.stack);
}
2014-01-20 08:40:56 +00:00
}