Make site generation work with new cljs

This commit is contained in:
Dan Holmsand 2015-03-22 11:49:23 +01:00
parent 767410d8d8
commit 60d99c44fe
3 changed files with 13 additions and 8 deletions

View File

@ -15,11 +15,11 @@ run: figwheel
# development build with auto-reloading and site generation
runsite:
@$(MAKE) run PROF=dev,site,$(PROF)
@$(MAKE) run PROF=+site,$(PROF)
# development build with figwheel, but no tests
runnotest:
@$(MAKE) run PROF=dev-notest,$(PROF)
@$(MAKE) run PROF=+dev-notest,$(PROF)
# production build with auto-rebuild
runprod: clean

View File

@ -8,7 +8,9 @@ var run = function (src) {
vm.runInThisContext(fs.readFileSync(src), src);
}
var loadSrc = function (mainFile, outputDir, devModule) {
var imported = {};
var loadSrc = function (mainFile, outputDir, devFile) {
var googDir = path.join(outputDir, "goog");
var optNone = false;
if (outputDir) {
@ -21,13 +23,16 @@ var loadSrc = function (mainFile, outputDir, devModule) {
}
global.CLOSURE_IMPORT_SCRIPT = function (src) {
var s = path.resolve(path.resolve(cwd, path.join(googDir, src)));
run(s);
return true;
if (!(s in imported)) {
imported[s] = true;
run(s);
return true;
}
};
run(path.join(googDir, "base.js"));
run(path.join(outputDir, "cljs_deps.js"));
goog.require(devModule);
run(path.join(outputDir, devFile));
} else {
run(mainFile);
}

View File

@ -3,7 +3,7 @@ var cljsLoad = require("./cljs-load");
var srcFile = "outsite/public/js/main.js";
var outputDirectory = "outsite/public/js/out/";
var moduleName = "reagentdemo.dev";
var devFile = "reagentdemo/dev.js";
var beep = "\u0007";
@ -15,7 +15,7 @@ if (typeof location === "undefined") {
var gensite = function () {
console.log("Loading " + srcFile);
var optNone = cljsLoad.load(srcFile, outputDirectory, moduleName);
var optNone = cljsLoad.load(srcFile, outputDirectory, devFile);
sitetools.core.genpages({"opt-none": optNone});
}