|
1 | 1 | ^: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" |
3 | 4 | :quarto {:author :timothypratley |
4 | 5 | :description "A lightweight way to cook with Clay and Scittle" |
5 | 6 | :type :post |
|
181 | 182 | ;; The new code creates a fresh experience without losing where we were. |
182 | 183 | ;; Just like adding water to the pan. |
183 | 184 |
|
| 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 | + |
184 | 212 | ;; ## Why Go Light? |
185 | 213 |
|
186 | 214 | ;; A Michelin-star kitchen is a marvel of efficiency. |
|
0 commit comments