Skip to content

Commit 432487e

Browse files
add info about clay deps
1 parent 82a1fc8 commit 432487e

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

src/scicloj/clay/uncompiled_clojurescript.clj

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
^:kindly/hide-code
2-
^{:clay {:title "The Sandwich Approach to ClojureScript Development"
2+
^{:kindly/options {:html/deps [:scittle :reagent]}
3+
:clay {:title "The Sandwich Approach to ClojureScript Development"
34
:quarto {:author :timothypratley
45
:description "A lightweight way to cook with Clay and Scittle"
56
:type :post
@@ -181,6 +182,33 @@
181182
;; The new code creates a fresh experience without losing where we were.
182183
;; Just like adding water to the pan.
183184

185+
;; ## Gotchas
186+
187+
;; Like any recipe, there are a few things to watch out for when cooking with Clay and Scittle.
188+
;; The main one is making sure you have all your ingredients (dependencies) ready.
189+
190+
;; Choose one of these three ways to include your dependencies:
191+
192+
;; * Let Clay add them automatically when it sees you need them (like in this post's first example)
193+
;; * Explicitly request them by adding `:kindly/options {:html/deps [:scittle :reagent]}` to your namespace metadata
194+
;; * Reference specific versions as JavaScript resources:
195+
;; ```clojure
196+
;; ^:kindly/hide-code
197+
;; (kindly/hiccup
198+
;; [:div
199+
;; [:script {:src "https://cdn.jsdelivr.net/npm/[email protected]/dist/scittle.js"
200+
;; :type "application/javascript"}]
201+
;; [:script {:crossorigin true
202+
;; :src "https://cdn.jsdelivr.net/npm/react@18/umd/react.production.min.js"}]
203+
;; [:script {:crossorigin true
204+
;; :src "https://cdn.jsdelivr.net/npm/react-dom@18/umd/react-dom.production.min.js"}]
205+
;; [:script {:src "https://cdn.jsdelivr.net/npm/[email protected]/dist/scittle.reagent.js"
206+
;; :type "application/javascript"}]])
207+
;; ```
208+
209+
;; If you see errors in th browser console like "reagent is not defined" or "Cannot read properties of undefined",
210+
;; it usually means a dependencies isn't loaded.
211+
184212
;; ## Why Go Light?
185213

186214
;; A Michelin-star kitchen is a marvel of efficiency.

0 commit comments

Comments
 (0)