Fork me on GitHub
#clojurescript
<
2020-04-13
>
dnolen01:04:33

for those people who are feeling adventurous - you can give the much improved JS bundler integration in master a spin https://github.com/clojure/clojurescript-site/blob/april-release-target-bundle/content/guides/webpack.adoc, feedback welcome

🎉 28
👍 4
dnolen01:04:13

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

dnolen01:04:04

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

dnolen01:04:46

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

dominicm07:04:29

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

Spaceman10:04:58

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?

hindol11:04:49

Were there any warnings/errors in shadow output?

andrea13:04:12

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?

Santiago13:04:28

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?

hindol14:04:01

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

4
mikethompson14:04:36

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

mikethompson14:04:49

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

andrea14:04:52

@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: https://github.com/day8/re-frame-template#hot-reloading-is-now-go

mikethompson14:04:47

@andrea I've corrected that, thanks

andrea14:04:31

ah, that was quick, thank you 🙂

mikethompson14:04:42

shadow-clj and figwheel are alternatives

Spaceman21:04:24

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

Derek21:04:55

Looks like when you start the router, put :use-fragment false in the options https://metosin.github.io/reitit/frontend/browser.html

Spaceman21:04:46

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}]]))

Spaceman21:04:38

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.

Spaceman21:04:41

How do I fix this?

Spaceman22:04:38

I have a re-frame subscription like so:

@(subscribe [:foo])
and in my subs.cljs, I have a subscription defined:
(reg-sub
    :foo
(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?

Spaceman22:04:37

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?

jaide03:04:01

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

jaide02: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.

mikethompson23:04:15

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