Skip to content
This repository has been archived by the owner on Jan 19, 2018. It is now read-only.

Commit

Permalink
check pre-rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Jan 25, 2017
1 parent cd3025a commit 5beed35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions build.boot
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 15,7 @@

(require '[adzerk.boot-cljs :refer [cljs]]
'[adzerk.boot-reload :refer [reload]]
'[adzerk.boot-test :refer :all]
'[clojure.java.io :as io])
'[adzerk.boot-test :refer :all])

(def version "0.1.0")

Expand Down
14 changes: 7 additions & 7 deletions tasks/render.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 23,21 @@
(div {:attrs {:id "app" :innerHTML html-content}})
(script {:attrs {:src "main.js"}})))))

(defn generate-html [ssr-stages]
(let [ tree (comp-container {} ssr-stages)
(defn generate-html []
(let [ tree (comp-container {} #{:shell})
html-content (make-string tree)]
(html-dsl {:build? true} html-content ssr-stages)))
(html-dsl {:build? true} html-content #{:shell})))

(defn generate-empty-html [ssr-stages]
(html-dsl {:build? true} "" ssr-stages))
(defn generate-empty-html []
(html-dsl {:build? true} "" {}))

(defn spit [file-name content]
(let [fs (js/require "fs")]
(.writeFileSync fs file-name content)))

(defn -main []
(if (= js/process.env.env "dev")
(spit "target/dev.html" (generate-empty-html #{:shell}))
(spit "target/index.html" (generate-html #{:shell}))))
(spit "target/dev.html" (generate-empty-html))
(spit "target/index.html" (generate-html))))

(-main)

0 comments on commit 5beed35

Please sign in to comment.