diff --git a/bb.edn b/bb.edn index b8bdd7f..298d44b 100644 --- a/bb.edn +++ b/bb.edn @@ -12,7 +12,11 @@ (spit "dev/replicant/public/theme.css" css) (io/make-parents "dev/squint/public/theme.css") (spit "dev/squint/public/theme.css" css) - (println "Copied theme.css to dev targets")))} + (println "Copied theme.css to dev targets")) + (let [adapter (slurp "dev/theme-adapter.js")] + (spit "dev/replicant/public/theme-adapter.js" adapter) + (spit "dev/squint/public/theme-adapter.js" adapter) + (println "Copied theme-adapter.js to dev targets")))} test {:doc "Run all unit tests" diff --git a/dev/hiccup/src/dev/hiccup.clj b/dev/hiccup/src/dev/hiccup.clj index 97473f3..abebf04 100644 --- a/dev/hiccup/src/dev/hiccup.clj +++ b/dev/hiccup/src/dev/hiccup.clj @@ -466,6 +466,7 @@ [:style (h/raw "html, body { margin: 0; padding: 0; }")] [:script (h/raw theme-persistence-script)]] [:body + [:script {:src "/theme-adapter.js" :defer true}] (sidebar/sidebar-layout {} (app-sidebar active-page port) (sidebar/sidebar-overlay {}) @@ -492,6 +493,11 @@ :headers {"Content-Type" "text/css"} :body (slurp "dist/theme.css")} + (= path "/theme-adapter.js") + {:status 200 + :headers {"Content-Type" "application/javascript"} + :body (slurp "dev/theme-adapter.js")} + (resolve-page path) {:status 200 :headers {"Content-Type" "text/html; charset=utf-8"} @@ -505,4 +511,4 @@ (defn start! [{:keys [port] :or {port 3003}}] (reset! !port port) (println (str "Hiccup server running at http://localhost:" port)) - (http/run-server handler {:port port})) + (http/run-server #'handler {:port port})) diff --git a/dev/replicant/public/index.html b/dev/replicant/public/index.html index ca22061..2e0b2a2 100644 --- a/dev/replicant/public/index.html +++ b/dev/replicant/public/index.html @@ -46,5 +46,6 @@
+