Fork me on GitHub

How does cljs know to remove (if from prod builds? Is there something in the compiler that recognises as the single test condition?

Roman Liutikov09:04:04

It’s not cljs, but Closure Compiler (the one that optimizes JavaScript output)


Also: Use goog/DEBUG instead of

Roman Liutikov09:04:27

With a type hint ^boolean goog.DEBUG Closure can infer the value. If it’s false, then the whole branch can be removed


Ok, so I need a type hint. I guess I meant, how does the compiler know that this can be evaluated at compile time rather than being a runtime condition.


So (def debug? ^boolean goog/DEBUG) and (when-not debug?) would be removed from the build?


@U0DHDNZR9 goog.DEBUG is controlled via :closure-defines which are basically compile time constants. so they get substituted by their value when optimizing.

👍 4

Got it, so basically it becomes (if false) and the closure compiler knows that it will never need that branch.


Type hint is probably not necessary for this to occur, am i right?


typehint is required because CLJS will emit if (cljs.core.thruth_(something)) which closure doesn't recognize


with boolean hint its just if (something)


is there a dominant technique for asset fingerprinting/far-future expiry with cljs builds? I'm having that fun experience of explaining how to do a hard-reload to some beta testers.


(or is there some other practice for making sure the latest compiled bundle is working?)


shadow-cljs has :module-hash-names if you are talking about fingerprinting the JS itself. see


no idea what others are doing


Oh thanks. I’ll have a look at that. Sadly this isn’t the project I’m flipping over to shadow (yet) but getting ideas is very helpful.


Thinking I could manually MD5 in a ring handler and just re-write the bundle <script> tag on the outbound index.html to add the suffix. Feels dirty, but workable.


has anyone had any success in getting the clog / clogn macros to work in a browser-based clojurescript application from


they just don’t print anything for me


@lee.justin.m it appears that it is doing a lot of cache-hostile macro trickery. you might need to block or turn off caching for this. see


@U05224H0W thanks, but there’s something more profoundly wrong about this. (clog "thing") is supposed to print “thing” and return thing, but it actually prints nothing and returns (debux.cs.clog/clog nil {:evals (atom {})})


I do see an added node_modules dir with uppy and deps in it. So I kind of feel i’m nearly there.


Just published the alpha for my service worker library. Thoughts? Feelings? Input in general would be appreciated 🙂


neat! what are you using it for @achythlook?


I'm building a webapp, and wanted to use service workers. My initial experience was absolutely dreadful, and I couldn't find any cljs libraries to help. Welp, I suppose its up to me 🙂


I'm going to use it, along with an app manifest, to make my webapp as close to native as I can 🙂


The incredible promise of service workers is that they can make our webapps faster and more accessible then native apps, including being available offline with much of the same functionality.


Given how important this tech is, I'm really concerned about doing this stuff correctly. The clojure community seems to stick to libraries that exist if they work well enough, so this library might be used widely and exclusively. I don't want to introduce any bad practices :S


How do you handle 3rd party css files in cljs? Example, I use the c3 chart lib (via cljsjs.c3). Do you copy the c3 css file to your resource-dir, or use a CDN, or is there another way to do it?


Great! Didn’t know about that. Thanks a bunch!


ah, the page references this lib 🙂


I've been learning ClojureScript and Reagent during easter. Everything has worked very smoothly. It has been even more positive experience than when I tried them out last time (2,5 years ago). Big 👍 for all people working on Clojure, ClojureScript, Figwheel, Reagent, Doo etc!

👍 8

amen to that @yka. i’ve used Rum for the last 3 years (which is totally fine) - decided to try re-frame + 10x out this weekend. had a blast.


re-frame is our weapon of choice. I’ve got a side project where I’m trying to see if I can use re-com for general purpose app development. Slightly stuck in a drag-n-drop rabbit hole.


How would you compare it to rum? I've been using only rum, and i've only ever really tried it along with om.


Sorry I missed this. Haven’t used rum so I’m not a good person to make a comparison.


@U0670BDCH rum is comparable with reagent. re-frame adds a state management and data flow coordination layer on top.

👍 8

oh that's helpful, I should check it out then


I did a bunch of Om work then moved to re-frame. It felt like re-frame addressed a lot of the missing pieces around how I should structure the front end of my app.