From a6cb21105a3373a9a82cf0fc4feadcf2d5099b97 Mon Sep 17 00:00:00 2001 From: Dan Holmsand Date: Sun, 30 Nov 2014 09:40:12 +0100 Subject: [PATCH] Tweak site-building Allow files in outsite to be opened directly --- Makefile | 4 ++-- demo/reagentdemo/news/anyargs.cljs | 2 +- demo/sitetools.cljs | 11 ++++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index faeae0e..20a5f23 100644 --- a/Makefile +++ b/Makefile @@ -34,11 +34,11 @@ clean: ## Subtargets figwheel: trigger-build - @echo "Will start figwheel server at:\nhttp://127.0.0.1:$(PORT)\n\n" + @echo "Will start figwheel server at: http://127.0.0.1:$(PORT)\n" lein with-profile $(PROF), figwheel serve-site: trigger-build - @echo "Starting site at:\nhttp://127.0.0.1:$(PORT)/public\n\n" + @echo "Starting site at: http://127.0.0.1:$(PORT)/public\n" ( trap "kill 0" SIGINT SIGTERM EXIT; \ ( cd $(SITEDIR)/.. && python -m SimpleHTTPServer $(PORT) & ); \ lein with-profile $(PROF), cljsbuild auto ) diff --git a/demo/reagentdemo/news/anyargs.cljs b/demo/reagentdemo/news/anyargs.cljs index c460458..a4e3bfd 100644 --- a/demo/reagentdemo/news/anyargs.cljs +++ b/demo/reagentdemo/news/anyargs.cljs @@ -132,4 +132,4 @@ [demo-component {:comp geometry-example}]])]])) (tools/register-page url (fn [] [main]) - (str "Reagent: " title)) + (str "Reagent 0.4.0: " title)) diff --git a/demo/sitetools.cljs b/demo/sitetools.cljs index 21ab298..d774ab2 100644 --- a/demo/sitetools.cljs +++ b/demo/sitetools.cljs @@ -103,7 +103,8 @@ (if (use-html5-history) (doto (Html5History.) (.setUseFragment false)) - (History.))) + (doto (History.) + (.setToken @page)))) (def history nil) @@ -119,9 +120,9 @@ (evt/listen h hevt/NAVIGATE (fn [e] (let [t (.-token e) - bp (token-base)] - (reset! page (if (and bp (== 0 (.indexOf t bp))) - (subs t (count bp)) + tb (token-base)] + (reset! page (if (and tb (== 0 (.indexOf t tb))) + (subs t (count tb)) t))) (reagent/flush))) (add-watch page ::history @@ -255,9 +256,9 @@ (let [conf (when (exists? js/pageConfig) (js->clj js/pageConfig :keywordize-keys true)) page-name (:page-name conf)] + (swap! config merge conf) (when page-name (set-start-page page-name)) - (swap! config merge conf) (setup-history) (set! (.-title js/document) (get-title)) (reagent/render-component (body)