This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-25
Channels
- # aatree (10)
- # beginners (59)
- # boot (314)
- # braveandtrue (4)
- # cider (50)
- # cljs-dev (12)
- # cljsrn (6)
- # clojure (206)
- # clojure-austin (2)
- # clojure-gamedev (90)
- # clojure-japan (1)
- # clojure-poland (12)
- # clojure-russia (10)
- # clojure-sg (1)
- # clojurescript (86)
- # core-async (2)
- # core-matrix (3)
- # cursive (40)
- # datomic (2)
- # dirac (13)
- # editors (25)
- # emacs (7)
- # hoplon (2)
- # immutant (10)
- # jobs (24)
- # jobs-discuss (1)
- # ldnclj (8)
- # lein-figwheel (19)
- # leiningen (1)
- # mount (7)
- # off-topic (34)
- # om (147)
- # onyx (11)
- # parinfer (151)
- # pedestal (2)
- # re-frame (31)
- # reagent (13)
- # ring-swagger (7)
- # spacemacs (1)
- # yada (11)
Is there a way to run filter against a PersistentHashMap and get out all the items which have values which are themselves PersistentHashMaps? How would I check for this? The item is basically a js object with several top level key value pairs which are just key : string and a few others which are key : object.
@dfcarpenter: sounds like you could use a combination of filter
with some simple predicate functions like map?
or associative?
If I am understanding the problem correctly
@chrisoakman: Thanks! I figured it out.
Anyone using chestnut? I’m not sure I understand the workflow. I can start a repl, (run) the webserver and figwheel and run (browser-repl), but then I only have access to the cljs repl and no access to the web repl (as it’s blocked). Is there any way to have both of them running? Or does everyone just rely on auto reloading and not evaluating specific sexps? Maybe I should be using multiple repls? But when I try to do it - one for the webserver and one for the cljs repl - the second one cannot pair with figwheel as it’s running in the original web repl process.
Is there a way to override pretty-printing on custom Records? like the simple-dispatch
on clj side?
Yes. There's actually a jira to do this generically if you want to vote for it
Oh sorry didn't realize I was in the clojurescript room, was thinking Clojure :)
there seems to be simple-dispatch on cljs.pprint too (https://github.com/clojure/clojurescript/blob/c72e9c52156b3b348aa66857830c2ed1f0179e8c/src/main/cljs/cljs/pprint.cljs#L2898)
@ikitommi: I never looked at that part so I don’t know - you should file an issue if it can’t be made to work and if it does work in Clojure
http://dev.clojure.org/jira/browse/CLJ-1890 is the clojure ticket to make this change the default which is in the list to look at for 1.9 (but no guarantees)
we are experiencing long compilation times when using threading macro + (many) multimethods. example here https://github.com/maio/slow-cljs-build I guess that I should report that to Jira? (cc: @dnolen )
@mfikes: Might be interesting to you related to Planck - cross platform Unix shell commands using Node - https://github.com/dthree/cash
So I've been rolling my own asset fingerprinting for CLJS (since I couldn't find anything available) and I'm at the point where I need to hook into the CLJS build to execute the fingerprinting after the CLJS is built, but before the jar is. I'm using lein-cljsbuild
and their hooks for the build itself and we deploy an uberjar. Has anyone done this sort of thing? I'm fumbling with adding my own hook (using robert.hooke) and it feels limiting because it's forcing me to internalize some environmental state.
I'm really surprised this isn't already a solved problem, actually... we got bit by a changed CLJS function arity with some browser-cached JS and I can't imagine we're the first.
@voxdolo: I’m finding leiningen quite difficult for these kinds of processes. I haven’t looked too deeply into boot, but I suspect it will be a better fit for asset pipeline stuff
@danielcompton: yeah, there's an existing boot task for doing fingerprinting too... the effort to move from lein to boot seems daunting though, given the infrastructure we've built around lein 😕
yep, same here
I think I can probably do what I want if I go the route of making it a full-fledged lein plugin (because then I create a settings map with the relevant external state), but wow... that feels like a long way to go.
It'd be really great if cljs.build.api
offered some extension points for doing this sort of thing.
dnolen: it's obviously your call I am curious how you deal with cache-busting though. It seems like a very real need when your ultimate consumer is a browser that has optimized highly around not re-fetching assets.
@voxdolo: integrating boot to do just the finger-printing + JARing seems perfectly reasonable to me
well, it's never quite as simple as just moving jarring to boot... that assumes a pretty shallow build process.
but using boot even just for creating our uberjar is a (greatly) non-zero amount of effort
or just write a bash script plus a Maven pom for this step, which is probably what I would do
if some tool is getting in the way - stop using it for that thing - that’s how I go about it
there’s a learning curve, but in my experience there’s fewer potholes simply due to maturity
fair points all, though. I'll think on it for a while. Thanks for the input and it's good to know that cljs.build.api
does not expose any hooks around its build intentionally.
@voxdolo: somebody might have even gone down this path might want to check the boot channel about this
dnolen: there is indeed a boot task for fingerprinting. I'm looking at just how heavily we depend on lein during our uberjar build and considering it. thanks again!
@voxdolo: are you shipping the cljs inside the uberjar? back when all the tooling was different, we just shipped a separate archive for static assets to be unzipped to a filesystem / served by nginx, and the output of the cljs build went into that assets directory
[just an experience share, in case you're like me and ignored the possibility of pulling assets apart from the uberjar]
trptcolin: yeah, we're shipping the CLJS inside the uberjar. deploying to heroku hamstrings some of your decisions around that sort of thing.
I could build the fingerprinted file and push it straight to our CDN... thanks for the nudge trptcolin!
arohner: we used to as well, but we use sass for CSS, which is why we moved away from it some time back. This was before we had any CLJS in our project though. I suppose it could be useful just for fingerprinting CLJS though.
google found: https://github.com/DomKM/optimus-sass thought I have no clue how useful it is
that's what we started out using too. at this point I don't even remember what it was that drove us away from optimus, but that lib had something to do with it.
we're doing sass compiles with gulp now (which, unsurprisingly, has fingerprinting support of its own)
I’ve been moving build stuff into myapp.build.foo
, and then calling from lein w: {:aliases {"deploy-assets" ["run" "-m" "rasterize.build.assets/export-upload”]}}
so when you build, you're pushing them to some external CDN that gives you back a hosted URL for them?
I’m using AWS Cloudfront. On my machine, optimus calculates sha1 of app.js, writes app-<sha1>.js to disk
at runtime, the server’s app.js file in the .jar has the same sha1, so it serves a link to <CDN DNS>/app-<sha1>.js
I'm knee-deep in a leiningen plugin at this point... so I'm going to follow this path to completion. I think there's a need for something doing this in a deployment-agnostic fashion, so maybe it'll be useful to others as well.
IMO, treat lein plugins like macros, only use them when you can’t do it any other way
if you just need to call a .clj fn from the command line, add an :alias that’s just lein run -m ns/name
so, without moving deploying the fingerprinted file to a CDN, I don't think I can inject myself into the build process at the point where I need to any other way than with a lein plugin. I need to fingerprint after lein-cljsbuild
, but before lein-uberjar
.
Hmmm... I could just invoke uberjar from my own task. it seems a little like semantics at that point though. I'm already using lein-cljsbuild
, so this sort of approach is already in play.
@voxdolo: this kind of thing is pretty straightforward in boot, don't know if that's an option
pandeiro: we've got a fair amount of infrastructure around lein in place that make it a pretty substantial move. Probably not something we would embark on to facilitate this specific use-case.
@voxdolo: reading back, are you wanting to deploy your app to Heroku in two archives? a jar for the backend and something else for the CLJS? We're (heroku) still trying to figure out what will work best for our customers wrt cljs. So if you have suggestions i'd love to here them--so i can make it easier for you
@codefinger: we're currently deploying our app as a single jar
yea, that's what we recommend now. but i keep hearing from people that don't want it in an uberjar--either because it's a SPA or some other reasons.
@voxdolo: not sure if this is helpful, but here is how I do cache busting for the CLJS cheatsheet: https://github.com/oakmac/cljs-cheatsheet/blob/master/Gruntfile.js#L116-L141
that's using Grunt.js (which would obviously be another tool on your stack), but the idea is simple and could probably be implemented anywhere pretty painlessly
@chrisoakman: interesting. at what point in your build process does gulp get invoked?
I develop locally with no file caching, then when I'm ready to push a build out I type grunt build
and then SFTP it over to a shared hosting account server
pretty low-tech, but quite reliable
I like re-naming the file because it makes it impossible for someone to get an "old" version, regardless of server settings, cache headers, etc