This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-06-19
Channels
- # beginners (50)
- # boot (82)
- # cider (42)
- # clojure (206)
- # clojure-india (1)
- # clojure-nl (2)
- # clojure-poland (2)
- # clojure-russia (1)
- # clojure-uk (6)
- # clojurescript (223)
- # code-reviews (17)
- # core-typed (3)
- # datomic (7)
- # dunaj (3)
- # editors (2)
- # instaparse (3)
- # jobs (1)
- # ldnclj (37)
- # overtone (3)
- # reactive (1)
- # reading-clojure (1)
- # reagent (24)
- # remote-jobs (1)
hilarious - https://github.com/clojure/clojurescript/commit/b882a4546dcdc8b4c4e8037074a6e473290d25ef
@dnolen: Wait… so the .cljc
file, when interpreted as :cljs
requires itself which is then interpreted as :clj
to grab the macros in it?
There some backlog from yesterday or before that explains macros in bootstrapped context
@razum2um: Also, the current (Clojure/JVM) ClojureScript compiler will be able to compile its own implementation into JavaScript. That (JavaScript) analyzer/compiler implementation won't be able to again compile the original implementation source, if I'm understanding correctly.
So, with ClojureScript JS, so long as you play by the rules and keep macros in separate files from runtime code files, it sounds like you will be able to use ClojureScript JS to compile things, right?
Is there a way in Reagent to trigger an event on another element? I’m trying to accomplish this http://stackoverflow.com/posts/12035542/revisions
Perhaps in the future .cljc
will find new use in writing ClojureScript macro files that are portable between ClojureScript JVM and ClojureScript JS. (For macros that use host interop when executing.)
Trying out the google closure way, but was wondering if Reagent has some utility functions to do this.
@roberto: I believe react (and thus reagent) doesn't provide a public api for triggering events programmatically. There is supposed to be code that simulates events for testing, but I don't know if it's appropriate for user facing production code
What do people do for environment variables in ClojureScript?
@danielcompton: you can use macro and read env variables in there. And can propogate value to clojurescript or do something based on this value with macro arguments.
Ahh that makes sense
@danielcompton: I also use different src folders for dev and prod, so I can have some dev or prod settings
Hey There, I’m getting started with Sente and I’m coming across a Websocket error. WebSocket connection to '<ws://localhost:3000/chsk?client-id=93475a0e-107e-4807-a6a7-1e34b712b737>' failed: Invalid frame header encore.cljs: Anyone happen to know if I should be looking at HttpKit or Sente to track this down?
@gonzih: wrote a blog post about it here: http://blog.michielborkent.nl/blog/2015/06/06/from-leiningen-to-boot/
@estsauver: have you tried the initial example?
@gonzih: the boot tasks seem to be more decomplected, whereas figwheel is more a monolith
@danielcompton: Got that error adding the readme to my project.
@gonzih: I'm still using leiningen and figwheel though, nothing wrong with it, works great
@danielcompton: still getting the Opcode -1
@estsauver: just from running the example project?
@estsauver: if you get error with raw exapmle project please report issue to the sente project. might be related to your setup or might be that example is outdated. hard to tell.
Not from running the example project, from copying the code from the readme into my project. The bare example project works.
@estsauver: then it's your setup
How can I embed Figwheel reload JS without transforming index.html, or hosting my HTML with jetty/figwheel? Is there a static bit of JS I can include in my index.html?
@petrus the reloader needs a connection to a server that tells it when something has changed
ok that makes sense
Created a new project from reagent template, but I'm not seeing in-browser reloads. Code reload seems to be working, but I have to manually refresh my browser. Am I missing some JS include?
In console I can see
Figwheel: trying to open cljs reload socket
Figwheel: socket connection established
How do you do your frontend dev? Do you refresh every time you change something?
got it working. Mismatched ports.
Running lein with-profile dev run
works, but if I try to run a REPL, I get this error:
#error {
:cause Could not locate qt/dev__init.class or qt/dev.clj on classpath.
:via
[{:type clojure.lang.Compiler$CompilerException
:message java.io.FileNotFoundException: Could not locate qt/dev__init.class or qt/dev.clj on classpath., compiling:(qt/repl.clj:1:1)
Where my project is named qt
.
Did I mess up my project.clj file?- seen when running lein repl
or lein with-profile repl
.
@petrus check your repl entry point configuration (namespace that should be loaded by default in relp)
@danielcompton: Thanks you two for the rubber ducky debugging.
@estsauver: good job!
@gonzih, where should I look? Is this it:
:cljsbuild {:builds {:app {:source-paths ["env/dev/cljs"]
:compiler {:main "qt.repl"
:source-map true}}
}
}}
@petrus looks like you have naming issue, can you should me content of env/dev/cljs folder?
It was set to qt.dev, which seems right. Probably shouldn't be looking at :cljsbuild,. Higher up in project.clj:
:profiles {:dev {:repl-options {:init-ns qt.repl
:nrepl-middleware []} ...
I have a file at ~/env/clj/qt/repl.clj
which has namespace qt.repl
there is cljs specific configuration for compiler and clojure specific in lein configuration
qt.repl is clj namespace. qt.dev is cljs.
Think I fixed it. I had (:use ... qt.dev ...)
in my qt.repl namespace
Does anybody know if serving stuff out of resources incurs a (noticeable) performance penalty? I really like the fact that I can deploy a single jar, but I wonder if there are hidden dragons and tarpits somewhere?
@jrychter: I’d be surprised if so. I mean it’s really all just files in jars right?
@thheller: well, I have to do that anyway, usually new JavaScript means API changes on the server side. @martinklepsch: something could (for example) reopen the jar and unzip it on every access. I don't know.
FYI: If you want to use figwheel with the newest cider-nrepl 0.9.0 do this: [lein-figwheel "0.3.3" :exclusions [cider/cider-nrepl]]
I tend to serve JS and CSS via S3, just so much easier to deploy
@martinklepsch: any advice on gzip on s3? last time I looked at it, it seemed pretty clunky
whats clunky?
@jrychter: I can constantly update client side only stuff (cljs, css, images ...) and have a deploy script that only restarts the server if any .clj changed
you gzip, supply Content-Type
and Content-Encoding
metadata and be done
I am scared of touching my (barely working) cider installation. I dream of the day when all the REPL stuff will come together and there will be a single stable solution… (though I suspect that will mean a singularity and the end of the world as we know it).
@martinklepsch: that doesn't sound too difficult
@borkdude: if you want to support clients that do not accept gzip, you’ll need some extra handling selecting which files to load
@borkdude: FTW haha
(deftask s3-deploy []
(comp
(gzip :files {"app.js" "app.js.gz"
"app.css" "app.css.gz"})
(s3p :secret-key ""
:access-key ""
:bucket ""
:put {"app.js.gz" "app.js"
"app.css.gz" "app.css"})))
@martinklepsch: wow, that looks useful. I'm thinking about switching to boot.
@martinklepsch: the handling of non-gzip files, do you do that in ring, to direct them at the right s3 file?
@borkdude: tbh, in that particular project I didn’t care enough to set it up, can’t find recent stats on accept-encoding headers but I’d guess it just works 99.9% of the time
Routing with secretary: I want to highlight the current menu item if the route matches. How do I ask secretary if "this url" matches a particular route without dispatching to that route?
Given (defroute users "/users/:id" [] ...)
, something like, (find-route "/users/1234")
=> value of users-route. In my navbar I render links like [:a {:href (users-route)} "Users"]
and I'd like to add an .active class when the current url matches that route.
secretary.core/locate-route-value
looks like it might be it.
@petrus: usually I just save some state inside defroute to remember which route is currently being shown
it's pretty short:
(defn locate-route-value
"Returns original route value as set in defroute when passed a URI path."
[uri]
(-> uri locate-route :route route-value))
Yeah that sounds simple too.@petrus: yes, I looked at it, but I still wondered what does it return and what can you do with it
@borkdude: regarding ring: I would probably make the html response contain either a link to the S3 file that’s gzipped or not. (no redirects)
@jrychter: well, if you have any questions etc, there’s #C053K90BR
@martinklepsch: that's how I'd do it too, or configure it in nginx somehow
@borkdude: how would you do it with nginx without redirects? modify response with some regex type thing?
@martinklepsch: I'm not sure, haven't tried it
@martinklepsch: maybe this is why I haven't tried S3 gzip before, it still sounds more work than just nginx gzip
@martinklepsch: provided your assets don't really have to be on s3
yeah, if you don’t want/need CDN probably nginx gzip is just fine. I personally just really like the lack of any maintenance w/ S3
Just wanted to say that what @shaunlebron is doing for documentation is fantastic. I already use the Dash.app docs regularly (one of the first versions), and just saw https://github.com/shaunlebron/ClojureScript-Syntax-in-15-minutes which looks great for bringing new people up to speed.
:thumbsup: also very happy with the Dash.app docset!
Is an "official" version coming? I'd love to be able to use it on my iOS Dash, too. (answering myself: just found it in the "User Contributed" section, not sure if it works on iOS)
In the User Contributed section.
yep, it’s really handy. And there are tools for Windows and Linux that can make use of the same docset format I believe
Is there something like Node-Webkit (NW.js) for building desktop apps with Clojure and ClojureScript? Some JVM-Webkit pairing?
@mikethompson: that is super cool!
@mikethompson: That’s nice but what I am looking for is something where I can use Clojure on the JVM and distribute it together with the cljs node webkit GUI. That way I could do heavy stuff like data analysis in Clojure and the GUI in CLJS/Webkit. The data analysis part needs to parse large files and transform the data. The GUI would visualize it.
@vschepik: I think your node-webkit gui can start clojure server and communicate with it using web sockets for example
@vschepik: If you want to see an Electron app (alternative to NW.js) running JVMs look at Cuttle: https://github.com/oakmac/cuttle
Electron (formerly atom shell) apps are a little harder to code than NW.js apps because there is a proper separation between "nodejs bit" and "chromium bit", but the full split has benifits.
@vschepik: an integrated solution seems impossible to me.
Electron and NW.js are nodejs combined with Chromium. There's no JVM in sight.
@mikethompson: Looks very interesting. I am open for alternatives to NW.js and Electron sounds interesting. I will definitely check Cuttle.
As @gonzih suggests you'll have to run the JVM as a seperate process and talk via some means ... for example websockets.
One sneaky approach is to try and run the JVM as an applet within Chromium. But that has a very limited life given applets are being dropped in the near future. And anyway, it probably won't do what you want.
@mikethompson: Yes, an applet is very restricted as far as I remember when I worked with applets many years ago.
Indeed. But that is the only way I can imagine a "fused" JVM and NW.js thing happening.
Other than that, you'll have to get your NW.js (or Electron) process to start a separate JVM process.
Good luck Cuttle will be a really good resource if you go that way.
@mikethompson: Thanks Perhaps it is sensible to use a Webkit component in a Java GUI window. But than the question is if it provides some API integration between JavaScript and the JVM. I build once something similar with Qt which provides a nice integration between JavaScript running in a Webkit control and C++.
@vschepik: JavaFx2 has a webkit component of some description. No idea how capable it is. Someone on the #C03S1KBA2 channel might have an idea.
@mikethompson: I will have a look at it. Seems to become a challenge
huzzah ClojureScript can now compile its own macros file w/o error. Still more to do but cool
@dnolen: Cool!
I'm getting errors using cljsbuild with new clojurescript (1.7). Is cljs.build.api the preferred way to build now?
ironic that the example on http://dev.clojure.org/display/design/Reader+Conditionals use speclj code.... I'm just working on conversion now
pushed code that demonstrates problem: https://github.com/slagyr/speclj/tree/clj17 $ lein cljsbuild once dev
@jrychter: if you use the docset from user-contributed section, it’ll auto-update. I update it pretty often
@shaunlebron: I switched to it now. Thanks for your work!
thanks, I’m so close to getting usage examples, and cross-refs; it’ll be a lot more useful soon
just trying to create the workflow for merging manual docs with the generated ones
@shaunlebron: I have a suggestion, btw. I'd move the box with the ClojureScript file hierarchy down to the bottom, as I think it is the least useful one to someone accessing the docs with Dash. The description, then the source, and then the map (though I'm not quite sure how it's useful, either).
I agree, I’ve been finding the file hierarchy takes too much space
the map is useful for me currently so I know the data that generated the markdown file
well, they’re concise. I like that it does what it aims for
this is just an intermediate view of the docs btw, it’ll look like this eventually in some form: http://oakmac.com/cljs.info/docs/cljs.core/bit-and
I wish there was a way to find, for example clojure.string/replace. Right now I think the only way is to find the clojure.string namespace and then click on "replace"
haha, bummer, I took the namespace out of the search key on your request, lol
but I see the benefit of having that as an option
😄 — well, you know how it is with users. But really, I am mostly surprised that just typing "replace" doesn't find string/replace.
@micah double check your assumptions. lein deps :tree first. Start a ClojureScript REPL and check clojurescript-version next
@micah: I saw this error recently, when trying to update to newer versions of libraries and tools. I think it was when trying to launch nrepl in figwheel, but I'm not sure anymore. I decided it isn't worth the effort after all.
jrychter: if you click the cljs logo by the replace search result, you’ll get the duplicates
@shaunlebron: oh, that's better, nice! And I just noticed that shift-enter will open the duplicates window, too. That's basically what I wanted — I don't actually want to type the full namespace.
@shaunlebron: the http://cljs.info preview looks really nice!
@jrychter: I got this error with figwheel too. I think it fixed that one by reverting to an older version of clojurescript (the figwheel author's recomendation)
This is just guessing. I never encounter these kinds of problems with Maven + bash scripts
@martinklepsch: it’s a start, it’s @chrisoakman’s mockup
@dnolen: does the following imply wrong clojurescript version too? clojure.lang.Compiler$CompilerException: java.io.FileNotFoundException: Could not locate cljs/util__init.class or cljs/util.clj on classpath: , compiling:(cljs/closure.clj:1:1)
Yeah, been checking deps. Looks like right version to me: https://gist.github.com/slagyr/d05ba187f03c5ab19c04#file-gistfile1-txt-L15
I suspect some crazy plugin is loading Clojure 1.6.0 but attempting to share the ClojureScript version in your project.
I had to exclude clojure and tools.reader from ring-middleware-format when I upgraded
@dnolen: Thanks for the help! cljsbuild works once again. But I'm still curious... do you recommend using cljs.build.api over cljsbuild? Now that I've got a custom build script using cljs.build.api, I'm appealed by it's simplicity.
I’m not the person to ask about cljsbuild, I don’t use it for app development only library development where the dependencies are highly controlled - also zero plugins
I'm having a hard time getting a browser-repl working with Cursive.
I made a new project from the regent template and when I run lein figwheel
I can issue commands in browser from this repl, but I'd like to be able to evaluate forms from Cursive in the browser. What am I doing wrong?
@petrus: There have been a few suggestions in the past: https://www.google.com/search?q=cursive+repl+site%3Aclojurians-log.mantike.pro%2Fclojurescript
@petrus if you’re familiar with the Quick Start you need a figwheel REPL script, same as any other plain CLJS REPL
@petrus: I don’t know about Cursive, but this works for me in emacs: https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl
Hello all! I have idiomatic question about re-frame. What is the best practice creating forms in re-frame? As example simple case -- login/register form in big SPA application (with validation, etc.)
is there a way to make node.js automatically reload namespaces recompiled by cljs.build.api/watch
? in particular, i'm running a web server in node.js and would like for url handlers to be reloaded as soon as i change them
@dnolen: ok thanks, let's try then wasn't sure whether that was still about reloading within the browser (but from a node web server)
ClojureScripts supports reloading in a variety of contexts, I assume Figwheel rides on that but would need to ask @bhauman to be sure
@dnolen: @sander: Figwheel does support node.js, it’s just better understood in a browser context.
@petrus: You can either run the figwheel REPL over nREPL (instructions are here: https://cursiveclojure.com/archive/1081.html#1082), or using a plain clojure.main REPL (gist here: https://www.refheap.com/101322, not properly written up yet, sorry)
@sander: Figwheel's the best route, but if you need another option, REPLs support
:watch
and :watch-fn
. Was able to imitate the basic functionality of Figwheel with this: http://blog.fikesfarm.com/posts/2015-05-30-poor-mans-figwheel-for-ambly.html