luminus

Benno Löffler 2021-06-02T12:04:39.015900Z

Hello! I used luminus and the 3rd edition of the corresponding book to learn clojure web programming. Great starting point! Got something up and running. Now I'm struggeling with "installing" bulma tagsinput: https://bulma-tagsinput.netlify.app/get-started/ I managed to install and compile sass for the new @bulmacreative bulma-badge and bulma-tooltip. The tagsinput component is different: it needs a js. First of all, I thought I need to include the tagsinput.js in the index.html - but I realized: It will be assembled to the app.js by shadow-cljs through the dependendies. My package.json contains in the dependencies section:

"@creativebulma/bulma-tagsinput": "^1.0.3"
My assumption: the bulma js for tagsinput will be included in app.js. The bulma docs asks to do: BulmaTagsInput.attach(); How do I do that with the hiccup I have? This is my try (I know, .attach should happen somewhere in initialization...)
(defn example-tagsinput []
 (let [_ (.attach js/BulmaTagsInput)]
  [:div
   [:div.field
    [:label.label "Tags"]
    [:div.control
     [:select {:data-type "tags" :data-placeholder "Choose Tags"}
      [:option {:value "one" :selected "true"} "One"]
      [:option {:value "two"} "Two"]]]]
   [:div.field
     [:label.label "Tags"]
     [:div.control
      [:input.input {:type "text" :data-type "tags" :placeholder "Choose Tags" :value "One,Two"}]]]]))
But that does not work... Even more confusing ist: As soon as I remove the <script src="/js/bulma-tagsinput.min.js"></script> from my index.html, the execution of the hiccup fails with: Uncaught ReferenceError: BulmaTagsInput My conlusion: the tagsinput.js dependendency is not includet in the app.js... Is there a description of an idiomatic way how to integrate bulma extensions? Any hint is wellcome.