mirror of https://github.com/status-im/reagent.git
Start cleanup
This commit is contained in:
parent
745cdf326c
commit
261166d4fe
|
@ -33,16 +33,13 @@
|
||||||
|
|
||||||
(declare page-content)
|
(declare page-content)
|
||||||
|
|
||||||
(defonce config (r/atom {;;:page-map {"index.html" [:div "Empty"]}
|
(defonce config (r/atom {:body [page-content]
|
||||||
;;:page-titles {}
|
|
||||||
:body [page-content]
|
|
||||||
:main-content [:div]
|
:main-content [:div]
|
||||||
:pages #{}
|
:pages #{}
|
||||||
:site-dir "outsite/public"
|
:site-dir "outsite/public"
|
||||||
:css-infiles ["site/public/css/main.css"]
|
:css-infiles ["site/public/css/main.css"]
|
||||||
:css-file "css/built.css"
|
:css-file "css/built.css"
|
||||||
:js-file "js/main.js"
|
:js-file "js/main.js"
|
||||||
:js-dir "js/out"
|
|
||||||
:main-div "main-content"
|
:main-div "main-content"
|
||||||
:default-title ""}))
|
:default-title ""}))
|
||||||
|
|
||||||
|
@ -132,11 +129,9 @@
|
||||||
[t {:dangerouslySetInnerHTML {:__html s}}])
|
[t {:dangerouslySetInnerHTML {:__html s}}])
|
||||||
|
|
||||||
(defn html-template [{:keys [title body timestamp page-conf
|
(defn html-template [{:keys [title body timestamp page-conf
|
||||||
opt-none req]}]
|
req]}]
|
||||||
(let [c @config
|
(let [{:keys [js-file css-file main-div]} @config
|
||||||
main (str (:js-file c) timestamp)
|
main (str js-file timestamp)]
|
||||||
css-file (:css-file c)
|
|
||||||
opt-none (:opt-none c)]
|
|
||||||
(r/render-to-static-markup
|
(r/render-to-static-markup
|
||||||
[:html
|
[:html
|
||||||
[:head
|
[:head
|
||||||
|
@ -147,15 +142,12 @@
|
||||||
[:link {:href (str css-file timestamp) :rel 'stylesheet}]
|
[:link {:href (str css-file timestamp) :rel 'stylesheet}]
|
||||||
[:title title]]
|
[:title title]]
|
||||||
[:body
|
[:body
|
||||||
[:div {:id (:main-div @config)}
|
[:div {:id main-div} (danger :div body)]
|
||||||
(danger :div body)]
|
(danger :script (str "var pageConfig = "
|
||||||
(danger :script (str "var pageConfig = " (-> page-conf
|
(-> page-conf clj->js js/JSON.stringify)))
|
||||||
clj->js
|
|
||||||
js/JSON.stringify)))
|
|
||||||
[:script {:src main :type "text/javascript"}]]])))
|
[:script {:src main :type "text/javascript"}]]])))
|
||||||
|
|
||||||
(defn gen-page [page-name timestamp]
|
(defn gen-page [page-name timestamp]
|
||||||
;; (reset! page page-name)
|
|
||||||
(dispatch [:set-page page-name])
|
(dispatch [:set-page page-name])
|
||||||
(let [b (r/render-component-to-string (body))]
|
(let [b (r/render-component-to-string (body))]
|
||||||
(str "<!doctype html>"
|
(str "<!doctype html>"
|
||||||
|
|
Loading…
Reference in New Issue