This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-03-17
Channels
- # bangalore-clj (1)
- # beginners (70)
- # boot (1)
- # cider (39)
- # cljs-dev (69)
- # clojure (56)
- # clojure-dev (1)
- # clojure-norway (1)
- # clojure-russia (4)
- # clojure-spec (1)
- # clojure-uk (10)
- # clojurescript (34)
- # clr (3)
- # community-development (3)
- # component (1)
- # datascript (1)
- # datomic (7)
- # emacs (1)
- # figwheel (3)
- # fulcro (5)
- # graphql (2)
- # hoplon (75)
- # jobs (4)
- # jobs-discuss (1)
- # luminus (15)
- # planck (3)
- # portkey (55)
- # re-frame (2)
- # reagent (2)
- # reitit (3)
- # ring (13)
- # ring-swagger (1)
- # shadow-cljs (72)
- # spacemacs (4)
- # tools-deps (2)
- # unrepl (7)
- # vim (2)
Hi. I have an static index.html file. Is there any support in shadow-cljs to update that on release to point to the latest js file, based on the hash generated and available in manifest.edn? I know how to do it if I have a server that serves the html, but in this case the app is client side only.
No worries, turned out to be pretty easy using the clj-run functionality
Hey, just curious, what's this thing for? http://take.ms/mHhEK
Also, I'm playing around with cljs-play and shadow-cljs. Unfortunately I'm getting the error: The required namespace "p5.core" is not available, it was required by "play_cljs/core.cljs".
. I tried npm install p5
which did update my package.json --- however cljs-play uses foreign libs ( https://github.com/oakes/play-cljs/blob/7fa4c33cf1cb734985366e8bdca1d7ed78546715/src/deps.cljs ) that I'm unable to satisfy using npm install p5
Any tips?
@escherize oops thats an UI experiment I'm working on in a branch. must have accidentally published it in the jar.
@mjmeintjes yeah clj-run
is a good solution. there is nothing built-in for this (yet).
@escherize your instinct was correct but to work arround foreign-libs
an extra shim file is required. they look like this https://github.com/thheller/shadow-cljsjs/blob/master/src/main/cljsjs/d3.cljs
so (ns p5.core (:require ["p5" :as p5])) (js/goog.exportSymbol "p5" p5)
. basically all they to is load the package properly from npm
and export the global name that cljsjs would otherwise create
don't need to close the PR. if you just push a new version of your fork it gets updated.
@thheller Juhopetri was saying that he thought react would never work without externs. How are you doing it in shadow?
to be fair support is getting better and will get better over time as more people move towards ES6
but currently its not reliable enough to use .. thats why its not the default in shadow-cljs
I just feel bad for people struggling to make it work who probably just want to get something working.
@bhauman besides from your ideas probably not. I have pretty much everything already.
I think shadow-cljs is much too low level and not built on the standard cljs.closure stuff at all
@bhauman while you are here. @mhuebert suggested the other day that it would be useful for libraries if they could hook into the live-reload process without the user having to configure it. eg. by adding a bit of meta to a (defn ^:on-jsload some-hook [] ...)
. I think you already have some special metadata in figwheel to do this stuff.
maybe we can decide on some generic names so things work in figwheel and shadow equally
if shadow-cljs I have :before-load
, :before-load-async
and :after-load
to hook into the respective points in the reload cycle
don't need it on the client. can just walk the compiler env when a compile finish and comb through the :defs
(for [[ns info] (::ana/namespaces compiler-env)
:let [{:keys [defs]} info]
{:keys [name meta] :as def} defs
:when (:on-jsload meta)]
[ns name])
this should be enough to extract the info required, then just send it to the client and let it do the thing
I was even thinking that fns like this could be automatically elided during release compiles but that would be way harder for you
do you have hooks for running code before loading any code already? or only :on-jsload
?
I added the async due to node. its quite frequent that you need to wait for something to actually finish before continuing, eg. when closing http servers
https://github.com/thheller/shadow-cljs/blob/master/src/dev/demo/script.cljs#L28-L34
that frequently failed if I just called (.close srv)
and immediately continued with live-reloading