This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-04
Channels
- # admin-announcements (36)
- # beginners (54)
- # boot (74)
- # cider (14)
- # cljs-dev (91)
- # clojure (197)
- # clojure-austin (1)
- # clojure-conj (3)
- # clojure-india (5)
- # clojure-japan (3)
- # clojurescript (111)
- # core-logic (12)
- # cursive (6)
- # datascript (3)
- # datomic (16)
- # devcards (26)
- # events (1)
- # funcool (11)
- # hoplon (63)
- # jobs (2)
- # ldnclj (10)
- # lein-figwheel (6)
- # luminus (5)
- # nginx (7)
- # nyc (3)
- # off-topic (1)
- # om (148)
- # onyx (122)
- # portland-or (5)
- # re-frame (3)
- # reagent (25)
- # yada (15)
Is there a good example of a full project that builds properly for both Clojure and ClojureScript (including tests!) with cljc?
Datascript builds for both
will be cutting a new release on Friday, if people know how to test their projects with master - do it
Thanks @taylor.sando . Do you know if it is possible to get Maven to run both Clojure and ClojureScript test suite at once?
I don't really know that much about Maven.
in reagent, when the call to the atom is included in a function...it does not do its magic right?
@richiardiandrea: the rule is a simple one: if, during the execution of the render function, an r/atom
is derefed, then that ratom will be considered an input signal.
yes, it was another problem (frustration, as usual )
tnx for the answer
Any idea why this would give a "goog is undefined" error? Shouldn't :optimizations :advanced take care of that?
:prod {:builds {:app {:source-paths ["env/prod/cljs" "src/cljs" "src/cljc"]
:compiler {:optimizations :advanced
:pretty-print false
:output-to "resources/public/js/app.js"
:output-dir "resources/public/js/out"
:asset-path "js/out"}}}}
and am including it via <script src="js/app.js" type="text/javascript"></script>
if that's what you mean?
It seems to be that I messed up my project.clj. If I'm modifying the top-level :cljsbuild then it compiles
It's something with my leiningen profile @dnolen . I'll try to see what is going wrong there. Thanks for your help
@lvh: [some experience report with node.js + :advanced] i have been using it in my electron app. I provide the necessary node.js externs. the only real reason over :static-fns is code obfuscation. I know its a pretty weak reason.
Yeah the problem is that ClojureScript code is far too regular for it to be a good obfuscation strategy
Hi guys. Does anyone know if I can get an element and change style (width for example) on it from clojurescript? Thank you.
in the old days before :pseudo-names
and :source-map
I would debug advanced build issues via pretty-printing only
@bojanx100: you can use (.getElementById js/document “app”)
to get a dom element with id app
.
@bojanx100: you can use browser JavaScript APIs for this. Lean on Google Closure if you want to protect yourself from browser quirks
@bojanx100: I’ve found this to be pretty good resource about learning about JS<->CLJS interop. https://kanaka.github.io/clojurescript/web/synonym.html
i did it with this (set! (.-width (.-style (.getElementById js/document "side"))) "0%") , @rohit: @dnolen: thanks!!!
@bojanx100: I think you can clean it up now with using goog.style and goog.dom. https://closure-library.googlecode.com/git-history/docs/namespace_goog_style.html
Here is an example for using goog.dom: https://swannodette.github.io/2013/11/07/clojurescript-101/
Hey if I'm reducing a vector of maps is there a way to affect other maps in the vector? In javascripts reduce I always return the entire array with modifications from each run of the function. I'm assuming the right way in clojure is that the reduce returns all the modifications and then I assoc-in as a secondary step. Is that right?
@puppybits: you can update directly in a vector (update-in [{:a 1}] [0 :a] inc)
=> [{:a 2}]
, can do that in reduce too
@thheller: ok so I map over my mutations and update-in to all the places in the vector that need to be changed. That make sense. Thanks.
So at Reactive 2015 there was a demo of http://cycle.js.org/, I was wondering if it would be a crazy idea to write that in maybe < 100 lines of code using Aleph (or core.async and transducers) + Hiccup + virtual-dom
A colleague of mine just wrote (without offending anyone here please) "A fully reactive JavaScript framework for Human-Computer Interaction" -> "The first web framework written by marketing specialist"
not sure , if you can write it in 100 lines of Clojure maybe it really is just marketing 😄
cycle.js does look interesting, but it doesn’t seem like much more than wiring up core.async to a VDOM thing
I guess this was my colleague's and @joelkuiper's point
fwiw I think core.async + React / Figwheel has shown that mutable observation is a big tradeoff
yes I see it as the (better) alternative to RxJS
Sorry David, I say better probably because I am biased towards the language core.async/React/Figwheel are using but yes I totally agree it is the same thing they are trying to accomplish, using the same machinery..as well (VDOM and being reactive).
any advice on how to do a clojurescript build for a release/deploy? in live should it still be loading N scripts from goog/
?
micahasmith: no — the build process will combine all the goog/… assets in non-:none optimizations (advanced being best)
do you know off hand what flag[s] i need to trigger that build style?
{:id "dev"
:source-paths ["src/analyticsjs"]
:figwheel false
:clean-targets ^{:protect false} ["resources/public/js/compiled" "target"]
:compiler {:main "analyticsjs.core"
:asset-path "/js"
:output-to "resources/public/js/cljs.js"
:output-dir "resources/public/js"}}
]
i think this was what i was missing.
@micahasmith: you’ll want to specify a production build and add :optimizations :advanced
to :compiler
trying out :optimizations :advanced
now
thx guys. i swear i searched all over the web for this 😉
going to.
this is my first ever cljs proj that im releasing
the issues are likely to be non-existent or minor unless you have external data/JS deps — those can be complicated
i didnt use the cljs externs/deps route for my external stuff, i just did js/
@micahasmith: right that’s going to be a problem
hahahhaha
micahasmith: would be curious what kind of stuff you were searching/googling for that didn’t come up — i could see a case for a wiki page or something about “putting cljs into production"
@micahasmith: if it’s a standard HTML5 you’re probably covered
micahasmith: looks like you’ve earned yourself a trip to the https://github.com/clojure/clojurescript/wiki/Dependencies page!
well at least i got to hear what my problem is before i experienced it
@nullptr my searches were lein figwheel deploy
lein cljsbuild deploy
lein cljsbuild clean
clojurescript deploy
i was looking for some wiki article or blog article that spoke directly to it. the cljs wiki that has the production deploy section at the end of it,,, shouldve saw it in my skimming
ok thanks for your help @dnolen and @nullptr going to jump into getting this fixed
that is helpful, at present we use optimize/min/advanced/production in different areas, and would be helpful to make the language more consistent here
To be fair, the figwheel leiningen template ought to include a setting to just compile clojurescript for production, instead of just packaging everything up into a jar
I am looking for how to share bidirectional routes (silk) between frontend (Reagent) and backend. Could somebody point me to the right direction, please?
@pshk4r: If you're using Clojure 1.7, I'd suggest reader conditionals (using .cljc files).
@domkm: thank you, I actually use 1.7, will learn about .cljc now P.S. thanks a lot for the great library
Guys, any tool in ClojureScript, Cljsjs or JS to strip Markdown formatting? Similarly to https://github.com/theJohnnyBrown/endophile ?
@richiardiandrea: is it on Github 😛 ? I might star it because it’s basically the same idea I had 😉 you loose a lot of the benefits of using shouldComponent update with immutable data structures, which I guess is the big caveat
@dnolen @nullptr— does this look like an acceptable way to import externs?
(ns analyticsjs.libs
(:require [goog.object :as object])
)
(def google (object/get js/window "google"))
(def jquery (object/get js/window "jQuery”))
@richiardiandrea: you could bolt that on with some meta-data or flag when passing around the values in the core.async channels , but you’d basically end up with something like React
@micahasmith: I would not do that
@richiardiandrea: although maybe it’s a more light weight solution, but you’d tie yourself into the Aleph/core.async infrastructure … but that might have the benefit of spitting out a nice flow diagram using some macro or somesuch
I don’t think you need to do anything special for Google Analytics but I don’t remember (if that’s what you’re trying to do)
i’m using google.visualizations
k. jumping into cljsjs docs
@richiardiandrea: I actually like the idea in concept (core.async, pure functions, Hiccup markup and just a simple virtual-dom diff+patch), but if you take into account the edge cases and the plumbing needed to make it an elegant solution with the updates etc, I guess you’d end up with something similar to React itself.