Tweak site-building

Allow files in outsite to be opened directly
This commit is contained in:
Dan Holmsand 2014-11-30 09:40:12 +01:00
parent 73f5ee53dc
commit a6cb21105a
3 changed files with 9 additions and 8 deletions

View File

@ -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 )

View File

@ -132,4 +132,4 @@
[demo-component {:comp geometry-example}]])]]))
(tools/register-page url (fn [] [main])
(str "Reagent: " title))
(str "Reagent 0.4.0: " title))

View File

@ -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)