Fork me on GitHub

outside of react/vue based solutions (i.e. reagent, om) what other librarise are used for cljs dom manipulation? [I'm not looking for anything in particular, just a list to look into]


@qqq sablano, reagent, jayq, dommy, domina


Hi guys, repeating my message from matrix. I’m trying to tame :npm-deps beast from clojurescript. So far I managed to make my om based project work on npm dependencies (react and react dom). I made following changes to project:

+                                            :pretty-print         true
+                                            :npm-deps             {:react     "15.4.2"
+                                                                   :react-dom "15.4.2"}
+                                            :install-deps         true
+                                            :infer-externs        true
+                                            :closure-defines      {process.env/NODE_ENV "development"}
And stubbed cljsjs.* packages in foreign libs because om depends on it.
+                                                                   {:file     "node_modules/react/dist/react.js"
+                                                                    :file-min "node_modules/react/dist/react.min.js"
+                                                                    :provides ["cljsjs.react"]}
+                                                                   {:file     "node_modules/react-dom/dist/react-dom.js"
+                                                                    :file-min "node_modules/react-dom/dist/react-dom.min.js"
+                                                                    :provides ["cljsjs.react.dom" "cljsjs.react-dom"]}]
and a change for prod build
+                                     :builds {:app {:compiler {:optimizations   :advanced
+                                                               :pretty-print    false
+                                                               :main            "raven.entry"
+                                                               :closure-defines {process.env/NODE_ENV "production"}}}}}}
It appears to be working, until I compiled this with advanced compilation of course.. My clojurescript version is 1.9.854, I also tried newer versions. I’m sure there is problem with dead code ellimination in closure compiler, but I don’t get any warnings from externs inferrer. Anyone managed to make similar scheme working?


What I want to avoid with all my heart is dealing with externs in any way. I want to make inferring work for me


@edvorg inference does work but a bug prevents the warnings, fixed in master


@edvorg I think React node module is going to require externs (until they change React), and inference doesn't help, because the code that breaks in optimization is inside React, e.g. defining properties dynamically (name won't be manged́) and then accessing them staticall (name will be mangled)y


For those you who have some time for pre-release testing, 1.10.191 should be available soon from Maven Central


In case anyone interested I found this awesome tool, it seems correctly generating externs for all the libraries I got from npm

generate-extern -f node_modules/react/dist/react.js -n React -o resources/public/vendor/ext/react-ext/react-ext.js
generate-extern -f node_modules/react/dist/react.js,node_modules/react-dom/dist/react-dom.js -n ReactDOM -o resources/public/vendor/ext/react-dom-ext/react-dom-ext.js
and then added it to externs
:externs ["resources/public/vendor/ext/react-ext/react-ext.js"
while I’m not using externs infering, neither I have to write externs myself. Now my project successfully runs with npm dependencies and advanced optimization from closure compiler


@dnolen thanks, I’ll give it another try when next release arrives


Hello, how to do server side prerender for single page app? I use reagent.


Usually people spin up js engine and call reagent render from there


As an alternative there is pure clojure solution to generate hiccup from reagent views and render it


You may check my (not yet ready) attempt to do it here based on blog post from @yogthos


The usage is simply

(defn first-view []
   [:div "something"])

(defn second-view []

(render [second-view]) ;; will generate hiccup from component


imo you either "server side render" or you "prerender", server-side rendering involves running your frontend code in the server, prerendering involves spinning up a js engine or headless browser


I'm a bit confused by the regex differences between cljs and clj. How can I make the following work in cljs? (clojure.string/replace ";test" #"&.*" "")


Java vs. JavaScript


That makes sense. My problem was unrelated to regexes


There is some macro on cljs to use template strings? some like (js-template js/graphql "My string ${js/js_vars}")


@mfikes I tried adding .wav "audio/wav" to here as you suggested. This got rid of the "cannot find *.wav" files errors, but now, when I trigger events I get an error like Uncaught (in promise) DOMException: The element has no supported sources..


I dug deeper into send-static and a few other functions, but for me, understanding how the REPL works is a little confusing.


Are there any resources for onboarding developers in CLJS development?


Hi , I'm working with using vx.shape inside cljs, the code in js should have been import ... from @vx/shape, in project.clj I wrote :npm-deps {"@vx-shape" "0.0.158"} :install-deps true and in cljs file I wrote in the ns scope: (:require ["@vx/shape" :as VXShape :refer [...]])


but then I got

Exception in thread "main" java.lang.AssertionError: Assert failed: cljs.analyzer/foreign-dep? expected symbol got "@vx/shape"
(symbol? dep), compiling:(C:\Users\epicl\AppData\Local\Temp\form-init3158851959428830190.clj:1:108)


It seems that I can't require scoped packages? Or we need some syntax other than @?


@clyce scoped imports don’t work w/o a fix to Google Closure


I’ve submitted a PR but it’s not finished yet


also won’t be available until a Closure release exists that has that merged


Hmm....OK I see


Thank you 😄


So we need to mannually package them using


If you are interested in the latest in the ClojureScript 1.10.x world, 1.10.191 is available to beta test