Fork me on GitHub

for those people who are feeling adventurous - you can give the much improved JS bundler integration in master a spin, feedback welcome

🎉 28
👍 4

these changes are beneficial regardless of whether you use ClojureScript, Figwheel, Shadow etc.


It means you can publish ClojureScript libraries that depend on NPM, i.e idiomatic wrappers for cool libs / ui components etc.


It's also a path to migrate off CLJSJS which requires a lot of manual effort from the community to mirror popular packages


I'm guessing it'll massively reduce bundle sizes when used with many npm dependencies too. I hope to measure this soon.


I have a shadow-cljs.edn file:

{:source-paths ["src/cljs" "src/cljc" "dev"]
 :dependencies [[reagent "0.8.1"]
                [re-frame "0.11.0"]
                [cljs-http "0.1.46"]
                [bidi "2.1.6"]
                [clj-commons/pushy "0.3.10"]
                [com.stuartsierra/component "0.4.0"]
                [environ "1.1.0"]]
 :dev-http {8080 "resources/public"}
 :builds {:myapp {:target :browser
                  :output-dir "resources/public/js/compiled/out"
                  :asset-path "."
                  :modules {:main {:init-fn cljs.user/go}}
                  :devtools {:after-load myapp.system/reset}}}}
And notice, I'm compiling the js to that output-dir. However, upon going to localhost:8080 although the folder resources/public is served, the js/compiled/out files aren't in that folder, even though they exist locally. Why would that be?


Were there any warnings/errors in shadow output?


noob q: I'm just starting with cljs. I created a new project lein new re-frame mp +re-frisk and I'm trying to get figwheel to work. Interestingly enough, running lein figwheel will show load empty page, if I edit anything and save, the open browser will automatically refreshes with content. Does anyone have any idea why the initial page might be blank?


I’m new to frontend dev, having only done APIs and other backend work. For my first SPA what should I use as permanent storage?


You mean, in the user's browser? There is LocalStorage.


@andrea I'm puzzled. The instructions say to do lein dev (not lein figwheel)


If so, it uses shadow-clj, not http://figwheel.It


@mikethompson thank you, I got into trouble following two separate tutorial thank you! Is shadow-clj an alternative (and incompatible with) figwheel? It looks like figwheel is mentioned in that page:


@andrea I've corrected that, thanks


ah, that was quick, thank you 🙂


shadow-clj and figwheel are alternatives


Hi guys, how do I get rid of the hashes in the Luminus project template during routing?


Looks like when you start the router, put :use-fragment false in the options


So this is my router: (def router (reitit/router [["/" {:name :home :view #'feed :controllers [{:start (fn [_] (rf/dispatch [:page/init-home]))}]}] ["/about" {:name :about :view #'about-page}]]))


and whenever I click on the button with the about link to it, I'm directed to localhost:3000/#/about instead of localhost:3000/about.


How do I fix this?


I have a re-frame subscription like so:

@(subscribe [:foo])
and in my subs.cljs, I have a subscription defined:
(fn [db]))
But upon doing the subscribe, I getting the error:
core.cljs:3894 re-frame: no subscription handler registered for: :show-menu. Returning a nil subscription.
why would this be and how do I dissect this issue?


Another question, I'm using :on-click in my reagent-reframe app to dispatch actions. However, the on-click events aren't triggered when tapped in my iPhone safari and presumably with all touchscreen devices. How can I fix this?

eccentric J03:04:01

What type of tag is your :on-click on?

eccentric J02:04:18

Try adding :on-touchstart click-handler or changing the clickable element to a button or a tag. I recall touch events not firing clicks on divs without a touchstart handler. :on-touchstart identity might work too.


@pshar10 you might want to ask your questions in the more specific #re-frame channel but be sure to read the docs first