This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-09-24
Channels
- # admin-announcements (17)
- # alda (5)
- # aws (4)
- # beginners (19)
- # boot (80)
- # bristol-clojurians (3)
- # cider (15)
- # clojure (257)
- # clojure-berlin (1)
- # clojure-czech (1)
- # clojure-indonesia (1)
- # clojure-nl (1)
- # clojure-poland (1)
- # clojure-russia (77)
- # clojurescript (186)
- # core-async (7)
- # core-typed (6)
- # cursive (8)
- # datomic (2)
- # devcards (2)
- # editors (45)
- # emacs (23)
- # hoplon (83)
- # jobs (1)
- # ldnclj (106)
- # leiningen (43)
- # off-topic (4)
- # onyx (31)
- # reagent (10)
- # yada (1)
I think I might have figured out the lein doo
memory issues. The project I was running didn’t have :jvm-opts
explicitly set. CircleCI’s boxes have 240GB of ram and report this much as being available to applications. My hypothesis is that the JVM thought it had plenty of room to grow before GCing and so pushed up past the 4GB memory limit enforced by Circle on any app testing. Adding :jvm-opts seems to have fixed the issue.
@dnolen:
> it doesn’t matter what optimization setting you use, ns-interns
will dump vars, remove it if you don’t want that
Yeah I figured that out in the end. What was throwing me is that the file metadata was definitely an absolute path in :advanced
compilation but a relative (to root) path in with :none
so when I was searching for the path string, I wasn't finding it at first. Once I knew what the culprit was and could jump straight to the relevant code, I could see all the var metadata (albeit with relative paths). Now that I know ns-interns
is the reason, my sanity is restored, and I have a couple of alternatives I can explore. Thanks though!
@dnolen It is worth mentioning, though, that the surprising behaviour wasn't ns-interns
output, so much as the absolute file paths that were present. I still find it surprising in fact, but I may be missing the relevant use case. In my current mind, it doesn't seem ever useful to know the location on disk of the machine that compiled the source, since that's not reasonably expected to be accessible from the consumer of the JS.
figwheel question: is there a way to get the behavior of {:http-server-root "public/js/out"} when running my own server? I can't use the built in figwheel ring server because I'm using HttpKit for websockets, and things work almost great except that figwheel is trying to reload files without respect to public/js/out
figwheel detects the file change and tries to reload the files but is looking for them in /
@benzen: If it's any help to you, I just keep my devcards in a separate project, such as this one: https://github.com/decomplect/ive
And I know @bhauman is probably busy with Strange Loop right now, but he's usually here on Slack providing help as well.
@benzen: you will have to do a wrapper ns that starts the ui and requires the namespaces you want the cards from. Then don't include this ns in the main application build
hmmm well https://github.com/enterlab/rente works great without http-server-root, so I must just be missing something
@mbertheau: so (.target event)
would compile to event.target()
. Minus prevents the call, so (.-target event)
compiles to event.target
initially clojure had no such thing since in Java you can understand if you're calling a function or accessing an attribute by typing
in javascript you can't determine that, so programmer has to tell the language what to do
@asolovyov: Ah. Thanks!
I'm trying to use :foreign-libs compiler option, it works if I use lein cljsbuild auto
but raises a "No such namespace:" error if the namespace is compiled via figwheel's autodetection... I'm at a loss how to track it down further. Any ideas?
@benzen: you can also have a Directory "devcards" that you only add to :source-paths
when you want devcards.
How would I elegantly create a vector ["begin" "a1" "a2" "b1" "b2" "end"]
where the middle elements are calculated from the sequence '("a" "b")
?
I have this: (-> [] (into (list "begin")) (into (for [letter '("a" "b")] [(str letter "1") (str letter "2")])))
which results in ["begin" ["a1" "a2"] ["b1" "b2"]]
I thought about just flattening that list, but I'd need just 1 level of flattening, and that's (apply concat)
and then that's not really elegant anymore:
(-> []
(into (list "begin"))
(into (apply concat (for [letter '("a" "b")] [(str letter "1") (str letter "2")]))))
(cons
"begin"
(for [letter ["a" "b"]
num [1 2]]
(str letter num)))
@danielcompton: I cannot express computing the elements from the letters as an additional iteration in (for) in my case
@mbertheau: why not?
For every element in ["a" "b"]
I must return in fact three elements that should end up in the vector.
@danielcompton: I simplified the case here.
I don’t quite follow, can you give the full case?
(Any other recommendations and hints to improve this code are very welcome as well )
@danielcompton: I find this code quite unreadable and am trying to improve it.
@mbertheau: I find it a little hard to read too First thing to do is probably to factor that out into several functions that can be called. I’m not able to run it because it’s depending on reframe and
bare-input
. If you’re able to make a slightly more minimal reproduction case I might be able to understand it better and help.
@danielcompton: I updated it, should be free of dependencies now.
@danielcompton: Revision 3 works.
@mbertheau: heres my fork
gotta run sorry
@mbertheau: I am only scanning and need to run as well but that second (into (apply concat))
seems like mapcat
might be useful there
Does anyone have examples of using goog.editor
with ClojureScript? I would be especially interested in bindings for any React wrapper
I already have somewhat working version: https://gist.github.com/Deraen/930022461005a9625f1b but before I finalize the bindings for Reagent I would like to hear if someone already has done this
What does the consumption of ClojureScript libs from Javascript look like? Is it just a matter of explicitly exporting friendly names (like mori does)? Can this be automated with metadata?
Hi @dnolen thank you very much for sharing your om-next-demo This is very instructive to read the source. I guess it is a read-only and not meant to be run ? I tried to build it and overcome some issues : changed ring handler namespace in
project.clj
. I have used the script/brepl.clj
to build the app.js but now I have issues when interacting with the app : mutation does not supply :action
Is it possible I missed a change to lein-cljsbuild? for some reason lein uberjar
deletes my compiled cljs before anything else, even though :jar true
is in the build profile used when I compile my cljs with lein cljsbuild once release
@canweriotnow: do you have
:profiles {:uberjar {:hooks [leiningen.cljsbuild]}}
nope... could be the problem
If I have multiple build configurations, do I need to pass that in as well?
I ran into this before and if I recall, it defaults to using the first build profile you have defined for cljsbuild
or does it match the build id to the profile used
ah, okay, Ill just reverse the order so my release build is listed first and my dev build is last.
yeah, that's what I had to do, if my memory serves me
my memory often serves no one, lol
I'll let you know how it goes. Trying now.
Whoa!
I think it's working...
Okay, it did indeed pick up the first defined build profile...
Ah, almost, but I think the problem is my fault...
Successfully compiled "resources/public/js/app.js" in 107.026 seconds.
Uberjar aborting because jar failed: duplicate entry: clerestory/history.cljs
Error encountered performing task 'uberjar' with profile(s): 'production'
Uberjar aborting because jar failed: duplicate entry: clerestory/history.cljs
Or actually I can blame my coworker for this one 😄
looks like you're getting close
Yeah, find . -iname history.cljs
only shows one file, so I'm a little confused... maybe there's a cljc of the same name? Hmm...
could be
nope 😞
you may need to :clean-targets ^{:protect false} [:target-path :compile-path "resources/public/js"]
so that lein clean
will remove the compiled js
@afhammad: (defn ^:export add-numbers [a b] (+ a b))
— are you asking about the automatic insertion of ^:export
?
Huh, I thought I actually had that already... lemme check...
It's in there... cleaning and running again...
No joy 😞
@canweriotnow: if you lein clean
can you verify that it is cleaning everything you need it to?
λ derpy clerestory → λ git master* → lein clean
λ derpy clerestory → λ git master* → ls resources/public/js
shiv.js
No compiled cljs present
what about find . -name "*.cljs"
to see if history.cljs
exists multiple places
λ derpy clerestory → λ git master* → find . -name "*.cljs" |grep history
./src/cljs/clerestory/history.cljs
run the find after running cljsbuild, it probably copies the cljs files to output-dir for source-maps
nope...
however...
λ derpy clerestory → λ git master* → find . -name "*.js" |grep history
./resources/public/js/out-release/clerestory/history.js
./resources/public/vendor/moment/tasks/history.js
But that shouldn't matter since it's an external js file, should it?Hmh, and if the cljs files were inside resources/public/js/ they wouldn't be duplicate as they would be in different path
I don'toutput source-maps for prod
only dev and staging
I would try removing ./resources/public/js/out-release
manually, maybe something got out of sync when changing the cljsbuild configs?
and ./target
modern-cljs is very outdated and Etudes for ClojureScript returns 404 page, why are they not edited out from ClojureScript wiki home page?
mm, verified that lein clean
is removing everything...
Ah... I may have something...
I have removed Etudes for ClojureScript link, hope a drone won't burn down my house in the night.
This has all happened before...
compiling now...
I hope...
heh, you can see my comment is the last one
Hah, I see
about the order of build targets
I still had :jar true
in my build target, hopefully that's it
ah, yeah I don't have that
no joy 😞
@tabrez: I haven’t look at modern-cljs in a while, is the issue simply that it refers to older versions of Clojure & ClojureScript?
@canweriotnow: which version of lein-cljsbuild
?
1.1.0
@hmadelaine: it’s probably possible to run it via lein
but I haven’t bothered setting that up, I’m just doing everything with a REPL at the moment since it’s changing so much. You can switch into todomvc.server
and run the top expressions in the comment in the bottom. Then launch script/repl.clj
, I just do that via Cursive.
@afhammad: that’s a use case that’s just not well supported unless it’s OK that cljs.core gets included into your module. Any ClojureScript library is going to be at lesat 30-40K gzipped (this is the case for Mori for example). But yes, if you want to do this use ^:export
or goog.exportSymbol
directly.
@dnolen: The last commit in modern-cljs was two years ago! The version numbers are old, the cljsbuild format in project.clj is outdated, there's no clean task in cljsbuild anymore. Just the first tutorial needed a bunch of changes which a new user is never going to figure out.
@dnolen: yeh its fine if cljs.core is included. looks like ^:export is what i need. thanks
@martinklepsch: thanks, wasn’t aware of the ^:export metadata.
@dnolen. lets say i want to export multiple separate libs that will be loaded optionally on the same platform, is it possible to compile cljs.core on its own and the libs that depend on it separately so that it is not downloaded with each lib. I’m not even sure I need this yet but just looking at my options.
@afhammad: probably something like this could be achieved with closure modules?
@martinklepsch: possibly, i’ll look into that.
@bostonaholic: success! key was using :prep-tasks
instead of :hooks
- found this: https://github.com/emezeske/lein-cljsbuild/issues/366
See @cemerick's comment at the end...
oh, interesting
Should also fix your issue with selecting the cljsbuild, I was able to do this: :prep-tasks ["compile" ["cljsbuild" "once" "release"]]
I wonder if this is new in 1.1.0
, all my projects are on 1.0.6
at the moment
probably not, opened in feb.
I don't think so, I think that's a striaght leiningen thing, orthogonal to cljsbuild?
thanks for adding to my TODO list @canweriotnow 😜
@afhammad: you can do code splitting but to be clear it’s not what people of think of them when they think of modules
@bostonaholic: thank YOU, would have taken MUCH longer to track that down without your help!
@afhammad: the splits can only work with each other (i.e. you could not swap in a different core or anything like that) and the sub module parts of the split are unusable without the base modules.
@canweriotnow: not a problem. happy I could help!
@afhammad: in general the weakest part of the ClojureScript story is creating a module for client-side JavaScript users. And that’s unlikely to ever change due to the Closure compilation strategy.
@dnolen: in my case its not so much a public lib that others will use in their apps. More of a framework that can be used (from JS) to build mini apps that will be compiled and run in a controlled environment, hence the need/want to share the core, but its not a deal breaker.
@danielcompton: Thanks! That pushed me in the right direction.
I'd still like to see something simpler for https://gist.github.com/mbertheau/9089f1a5c5e1c83130d2
I can’t get CLJS to load in IE9, anyone had this issue? ClojureScript could not load :main, did you forget to specify :asset-path?
strange how it’s inconsistent depending on environment though…hrm
@ddellacosta: when using :main
with :none
we load via document.write
@ddellacosta: https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/closure.clj#L1153-L1157
is the relevant code, we might be doing something wrong, but easy to test this by dropping :main
and writing the code by hand and see what’s wrong.
yes, that I figured out—I guess what I was ignorant of is that IE9 doesn’t support this, or is buggy in this case
don’t have IE9, so happy to take a patch that fixes :main
support under :none
for it, no doubt something simple
yeah, will poke at it a bit and see what I can figure out. Thanks dnolen
@ddellacosta: make sure everything about your markup is correct, disable quirks mode (declare HTML doctype) etc.
good points, thanks
will do!
there’s a good chance it’s an HTML issue, pretty sure IE9 is fine w/ document.write + checking if a JS thing is loaded immediately after
@mbertheau: I suggest (cons "begin" (conj (into [] (mapcat f [\a \b \c])) "end"))
@meow: Thanks. Still seems complicated to me, especially given how clojure is very pragmatic and readable usually.
I'd like something like (make-vector ["begin"] (mapcat f [\a \b \c]) ["end"])
. I could write that of course.
I couldn't reproduce against the latest version, so whatever it is, looks like you already fixed it
To make dnolen’s example a little clearer:
`["begin" ~@(mapcat f [\a \b \c]) "end"]
Is there a clojurescript equivalent to https://github.com/clojure-emacs/clj-refactor.el ?
@shofetim: Cursive Clojure has refactoring support for ClojureScript, though I don’t think it supports everything in clj-refactor
@danielcompton: @shofetim: No, it doesn’t, sadly.
@cfleming doesn’t support cljs, or doesn’t support everything in clj-refactor?
It does support cljs, but it doesn’t support everything in clj-refactor, even for Clojure.
@danielcompton: thanks @cfleming thanks too
I was thinking that Cursive's support for cljs was limited, I'll have to give it another go.
hm. Requiring [goog.dom.xml :as xml] results in ExceptionInfo #object[TypeError TypeError: goog.dom.xml is undefined] when I try to use it. Isn’t the Closure library supposed to be available by default?
is goog.dom.xml in the *bundled* Clojure library? I think an upcoming clojurescript release will bring google clojure up to date.
lvh: sorry, I don't know. I recall seeing a bug report about that recently, but now all I can find is this: http://dev.clojure.org/jira/browse/CLJS-535