This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-02-25
Channels
- # announcements (5)
- # beginners (74)
- # boot (5)
- # cider (57)
- # cljdoc (5)
- # cljs-dev (45)
- # clojure (37)
- # clojure-dev (6)
- # clojure-europe (4)
- # clojure-italy (17)
- # clojure-nl (11)
- # clojure-spec (48)
- # clojure-uk (96)
- # clojurescript (79)
- # cursive (17)
- # data-science (1)
- # datomic (27)
- # emacs (2)
- # fulcro (22)
- # immutant (1)
- # java (62)
- # juxt (4)
- # kaocha (4)
- # lein-figwheel (5)
- # leiningen (6)
- # midje (1)
- # mount (1)
- # music (3)
- # nrepl (6)
- # off-topic (49)
- # pathom (10)
- # pedestal (2)
- # re-frame (43)
- # reagent (2)
- # ring (2)
- # shadow-cljs (78)
- # spacemacs (6)
- # test-check (2)
- # tools-deps (4)
Dear cljs folks! I was wondering how the js interop plays with minification. I believe literal #js{} syntax maps directly to js so that strings will not be minified and keywords will. I was wondering how to specify this behavior with aget, ie. whether (aget foo bar) maps to foo[bar] or foo.bar. Thanks for any pointers!
Guys, do you know how to find Clojurescript React and React-Native template to buy ?
@vnorilo_clojure aget
is not that flexible (it uses string access) and should be used only for js array access, the only library I know of which allows you to specify the behaviour at each call site is https://github.com/appliedsciencestudio/js-interop
thanks!
It looks very interesting. I noticed that cljs-oops includes cuerdas which has quite an impact on the compiled JS size. As far as I can tell js-interop should also help with this.
@U04V15CAJ valid point, working on a fix
@vnorilo_clojure also note that keys in a literal #js{} object are not minified
(let [o #js {:yyyyyy 10
"zzzzzz" 20}]
(is (= (j/get o .-yyyyyy) (if advanced? nil 10)))
(is (= (j/get o :yyyyyy) 10))
(is (= (j/get o .-zzzzzz) (if advanced? nil 20)))
(is (= (j/get o :zzzzzz) 20)))
you can use j/obj
to create objects with minified keys https://github.com/appliedsciencestudio/js-interop/blob/master/src/test/applied_science/js_interop_test.cljs#L433
Have anyone attempted using reakit with clojurescript? https://reakit.io/
No, but if they expose React components, it's relatively straightforward to use them with Reagent.
Hello, for users of shadow-cljs + reagent, I am working on a long form and was wondering if there was a way to preserve scroll position of the web page on live reload?
you can probably capture the scroll position in a :dev/before-load
hook and restore it in a :dev/after-load
hook? https://shadow-cljs.github.io/docs/UsersGuide.html#_lifecycle_hooks
I’m trying to reduce bundle size. I’ve shifted all bloated js-libs (OpenLayers, MaterialUI…) to webpack from cljsjs to get DCE and my foreign libs bundle is now 1.6MB without gzip. Whole bundle with remaining deps and my own code is 3.3MB in total with 20K LoC in cljc and cljs files.advanced optimizations
, including the webpack bundle. I wonder what could be causing 1.7MB difference here. I’ve
My project.clj
looks like this https://github.com/lipas-liikuntapaikat/lipas/blob/dev/webapp/project.clj
I’ve been trying to narrow down what is still causing the cljsbuild size to explode. Any ideas? 😮
shadow-cljs has rather detailed build reports but they don't work with cljsbuild builds https://shadow-cljs.github.io/docs/UsersGuide.html#_build_report
I tried with :verbose true
and I saw something suspicious. It’s giving output about deps that belong to re-frame10x
which should be there only in dev profile
"cljsjs.react-autosugges"
this looks like a typo? that may end up including the foreign-lib instead of the webpack one?
@thheller https://lipas-dev.cc.jyu.fi and thank you already for being so helpful!
I’m a bit frustrated since I started this morning with 1023KB bundle (gzipped) and currently I’m at 992KB 😂
Yeah, my best guesses so far are that there’s either a) something transitively getting pulled to the cljsbuild or b) something leaking from dev-deps to prod build.
I think I’ll sleep on it and take another look tomorrow. Thanks one more time for support @thheller
/**
* @license
* Latitude/longitude spherical geodesy formulae taken from
*
* Licensed under CC-BY-3.0.
*/
maybe thats a clue? that looks like a foreign-lib include that wasn't processed by webpack
https://github.com/lipas-liikuntapaikat/lipas/blob/dev/webapp/src/js/shp2geojson.js#L14 could this cause something terrible?
Meh, it’s not proj4, I tried dumping it from the bundle and required it from CDN but didn’t help.
you can identify the start of the generated CLJS :advanced
output via
;(function(){
var e,goog=goog||{}
you can try https://www.npmjs.com/package/source-map-explorer. it will just show a big blank area for the foreign-libs
it looks like there is a huge map of strings (maybe translations?) that alone is 200kb
the problem with storing strings in large maps is that the code to build those maps add a bunch of overhead
if you load the strings at runtime via XHR request to fetch a raw .edn
file it will be a whole lot smaller
or if you must have them in the code keep them as a pure #js
object. that will also be substantially smaller
I'm on ubuntu 18.04 and having some trouble getting figwheel up and running. I have not done other clojure/clojurescript development in the past so this might be a bigger issue with my environment in general.
After starting a project with lein new re-frame test-app
I get the following error when i try to start up the figwheel development environment
lein figwheel dev
Figwheel: Cutting some fruit, just a sec ...
Exception in thread "main" java.lang.RuntimeException: Reader tag must be a symbol, compiling:(/tmp/form-init8827327389273899324.clj:1:1457)
at clojure.lang.Compiler.load(Compiler.java:7386)
at clojure.lang.Compiler.loadFile(Compiler.java:7317)
...
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
Caused by: java.lang.RuntimeException: Reader tag must be a symbol
at clojure.lang.LispReader$CtorReader.invoke(LispReader.java:1221)
at clojure.lang.LispReader$DispatchReader.invoke(LispReader.java:684)
at clojure.lang.LispReader.read(LispReader.java:263)
jdk 10, i think?
0 - ❯❯❯ java -version
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)
what should I look into for how to fix this?Ahh, ok. The data blobs are in code because they’re needed all around the backend/frontend and the data almost never changes. But maybe it would be a good idea to load them separately.
Thanks one more time @thheller! You were super helpful. I’ll try the source-map thingie tomorrow and after that I probably have to start thinking about better place for my data than source code 😉
i figured out my issue -- something about the lein template is out of date and was fixed by using the lein-ancient
plugin updating some stuff https://github.com/Day8/re-frame-template/issues/84
+"1e21"
suffices if you're working in Javascript.
see also Number.parseInt
.
I'm sure cljs.core has a function for this, but I don't know what that is.
oh, right: parseFloat. the eX
syntax is only for doubles.
oh how about that. also some friend of mine just informed me that "1e+21" has nothing to do with base e
thanks, by the way @braden.shepherdson!
Hi. Can someone help me with connecting cider to re-natal on android? I get a timeout when i try cider-jack-in-clj on a hello world app
Might try posting in #re-natal as well. Don't have much experience in re-natal so wouldn't be much help without taking a bit of time to dig into it.
Could you share the contents of the *nrepl-server ...
buffer after it fails?