This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-02
Channels
- # beginners (29)
- # cider (41)
- # clara (1)
- # cljs-dev (17)
- # cljsrn (1)
- # clojure (158)
- # clojure-dev (2)
- # clojure-dusseldorf (2)
- # clojure-italy (8)
- # clojure-mexico (1)
- # clojure-russia (2)
- # clojure-spec (43)
- # clojure-uk (1)
- # clojurescript (44)
- # community-development (98)
- # cursive (9)
- # data-science (8)
- # datascript (4)
- # datomic (30)
- # emacs (6)
- # fulcro (11)
- # graphql (6)
- # jobs (1)
- # jobs-discuss (27)
- # lein-figwheel (5)
- # luminus (13)
- # lumo (4)
- # off-topic (28)
- # onyx (9)
- # parinfer (12)
- # perun (2)
- # portkey (5)
- # re-frame (48)
- # ring (2)
- # shadow-cljs (52)
- # spacemacs (29)
- # tools-deps (15)
- # unrepl (9)
- # vim (7)
- # yada (3)
How does cljs know to remove (if js.goog.DEBUG)
from prod builds? Is there something in the compiler that recognises js.goog.DEBUG as the single test condition?
It’s not cljs, but Closure Compiler (the one that optimizes JavaScript output)
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.
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
Got it, thanks
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.
shadow-cljs has :module-hash-names
if you are talking about fingerprinting the JS itself. see https://shadow-cljs.github.io/docs/UsersGuide.html#NameHashing
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 https://github.com/philoskim/debux
@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 https://shadow-cljs.github.io/docs/UsersGuide.html#_compiler_cache
@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?
there’s also this @U05542278 https://github.com/Deraen/ring-cljsjs
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!
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. https://github.com/robert-stuttaford/bridge/
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.
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.