Skip to content
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.

Commit

Permalink
pop-out CSS works!! (again)
Browse files Browse the repository at this point in the history
  • Loading branch information
lilactown committed Feb 1, 2019
1 parent aa64077 commit 526bbb9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
18 changes: 11 additions & 7 deletions adapter-web/src/punk/adapter/web.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,25 @@
;;

(def default-script
"https://cdn.jsdelivr.net/gh/Lokeh/punk@0.0.2-alpha.5/ui/dist/js/main.js")
"https://cdn.jsdelivr.net/gh/Lokeh/punk@v0.0.2-alpha.6/ui/dist/js/main.js"
;; "http://localhost:8701/main.js"
)

(def default-css
["https://fonts.googleapis.com/css?family=Source+Sans+Pro"
"https://cdn.jsdelivr.net/gh/Lokeh/punk@0.0.2-alpha.5/ui/dist/css/grid-layout.css"
"https://cdn.jsdelivr.net/gh/Lokeh/punk@0.0.2-alpha.5/ui/dist/css/resizable.css"])
"https://cdn.jsdelivr.net/gh/Lokeh/punk@v0.0.2-alpha.6/ui/dist/css/grid-layout.css"
"https://cdn.jsdelivr.net/gh/Lokeh/punk@v0.0.2-alpha.6/ui/dist/css/resizable.css"])

(defn ^{:export true}
start
([] (start nil))
([opts]
(let [{:keys [ui/script ui/css]
:or {script default-script css default-css}} opts]
(let [default-opts {:ui/script default-script
:ui/css default-css}
opts-with-defaults (merge default-opts opts)
{:keys [ui/script ui/css]} opts-with-defaults]
(if (. js/document getElementById "punk")
(start-ui! opts)
(start-ui! opts-with-defaults)

;; first time running
(let [new-container (. js/document createElement "div")
Expand All @@ -73,7 +77,7 @@

(set! (.-onload ^js script-tag)
(fn []
(start-ui! opts)))
(start-ui! opts-with-defaults)))
(-> js/document .-body (.appendChild script-tag))

;; css
Expand Down
Loading

0 comments on commit 526bbb9

Please sign in to comment.