This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-18
Channels
- # beginners (15)
- # boot (23)
- # cider (8)
- # clara (29)
- # cljs-dev (86)
- # cljsrn (36)
- # clojars (9)
- # clojure (211)
- # clojure-dusseldorf (5)
- # clojure-italy (21)
- # clojure-sg (2)
- # clojure-spec (4)
- # clojure-uk (12)
- # clojurescript (204)
- # cursive (5)
- # data-science (12)
- # datomic (15)
- # dirac (99)
- # emacs (1)
- # events (2)
- # figwheel (1)
- # fulcro (9)
- # graphql (27)
- # hoplon (50)
- # instaparse (9)
- # juxt (61)
- # keechma (6)
- # leiningen (1)
- # luminus (4)
- # lumo (24)
- # off-topic (24)
- # om (16)
- # onyx (17)
- # parinfer (35)
- # pedestal (3)
- # planck (12)
- # protorepl (8)
- # re-frame (15)
- # reagent (22)
- # ring (1)
- # rum (1)
- # spacemacs (3)
- # uncomplicate (4)
- # vim (5)
- # yada (1)
@selfsame there’s also lumo -D group/artifact:version,othergroup/artifact:version
(artifacts must be in your local maven cache (i.e. already downloaded)
I still can't figure out what Meta is
or how to use it
@josh_horwitz the next release will be much more stable, meta is essentially an sdk for building applications, it operates by generating applications which use its built in framework, it wraps the ui, client and server in a neat package
However it doesn't implement any application logic, so a generated project can be directly hacked on
I do have a repro if anyone is curious https://github.com/iku000888/tiny-samples/tree/master/node-and-cljs
@bhauman @anmonteiro about class... I always assumed reify or proxy would work for that but never really tried..Maybe that is the most idiomatic way?
Apologies if this has been asked before. Given a clojure Spec like the following, is it possible to extract the required keys again ?
(s/def ::composed
(s/merge ::base (s/keys :req [:key3 :key4 :key5])))
hey guys, if you need to load a configuration json from code base how do you do it? If I make a request, most libs give me async channels, but I'd like to block until config json is loaded.
that’s because all network apis in the browser are callback based, @roklenarcic
@roklenarcic you could do a synchronous XHR
right I know they are callback based, which is why I'm asking how do javascript developers (which I'm not) solve this problem, which is loading up a config json and i18n json at app startup
it complicates things immensely
ok, how would I do synchonous XHR
something like
(let [req (js/XMLHttpRequest.)]
(.open req "GET" "config.json" false)
(.send req nil)
(-.responseText req))
ok I will look into this
Hello. What library/tool is mostly used for server-side rendering in React+ClojureScript apps?
@andrewboltachev take a look at Rum library
having used om-classic and js react, I think rum is more flexible, but also terser and less annoying to use, no need for manual sablono.
om's cursors aren't great for everything, rum has cursors and other state strategies but doesn't force you to use them.
Is it better than Reagent?
anyways Rum uses macros. I don't like usage of macros LOL 😄
ok. efficience matters, I agree
I think not being afraid of macros is a good strategy in a lisp 🙂. Rum's pretty small, though. It's sablono + a component wrapper and some helpers for state.
I haven't used reagent but it seemed too opinionated to me, people seem to like re-frame (built on top) for larger-scale applications.
yep, I've used re-frame a lot
what I like in the reagent+re-frame is a tend to make everything declarative
Yea, if you already know reagent, I'm not sure if learning rum is going to help you do SSR better
there's a really out-of-date howto that might be helpful: https://github.com/reagent-project/reagent-cookbook/tree/master/recipes/reagent-server-rendering
actually this is a nice feature of rum: > Rum server-side rendering does not use React or Sablono, it runs completely in JVM, without involving JavaScript at any stage.
huh, indeed
but there's a bit of interference between classical Hiccup and...
at least with Hiccup syntax as it's used by Reagent well, probably Rum's markup is very similar to classical Hiccup?..
yea, I'm not sure how reagent's is implemented, but I think Rum uses sablono for this job
I've started using boot-cljs and a boot build, but when I run the task, compiled files don't show anywhere in project tree
it somehow run-development task works, reloading and page works
but build-development doesn't produce any files
at least not in project folders
@roklenarcic shouldn't it be a single output file when using :optimizations :advanced
?
there's no output at all
in any case
how do you know?
may be it overwrites your other files?
there's no new files in my project tree
i.e. the old ones
but there are no old js files
it says compiling meds.js
after it finished, there's no such file in project tree
or a similar one
there's no js files whatsoever
in "project tree" or in a filesystem?
filesystem
uhm that's a little funny then
I've read the docs of boot-cljs
and it says I don't have to specify output-dir
@roklenarcic Your Boot tasks don't output any files, you need target
task or something similar. Boot doesn't write anything to working directory, unless you tell it to.
really? I copied this from an example of a boot project
not even my invention
interesting @juhoteperi @roklenarcic so this is probably how so-called "pods" work?
Hmm, yeah, boot-cljs-example is out of date. That would work with boot 2.5 and old boot-cljs, but Boot 2.6 removed the implicit target task.
@andrewboltachev No, not related to pods, those are about isolating dependencies, this is about Boot tmp-dirs and fileset.
@juhoteperi got it, thanks
so I need to add a target task?
@roklenarcic Yes, (target :dir #{"target"})
should do it. After cljs task, before serve.
the funny thing is that the run-development task works, it compiles/reloads/serves the page
so it's pulling files from some temp dir somewhere
Yes, serve
can serve the files from classpath (which includes the Boot temp-dirs with output role)
And cljs
task automatically adds the files to the fileset with output role
Is there a "mostly safe" way to replace a transitive cljsjs dependency with node modules? Say I want to use devcards in an application which uses react from node modules. Looks like global exports might help here.
Hi @deas I've experience connecting React from node_modules
@deas based on this article: http://blob.tomerweller.com/reagent-import-react-components-from-npm
@deas that’s one of the big ideas behind global exports - but artifacts have to transition to that first before end users have an easy migration path
@dnolen I was wondering whether it should be possible to say swap out cljsjs.react
in your project with a node module based version - with devcards or other libs being unaware of that.
@selfsame yeah that’s an old discrepancy from ~5 years ago - I suppose we could change that, but maybe not worth it
@dnolen cljsjs.react
has to change because there is no way to override deps.cljs from the jar?
I usually just put the files under prefix in uberjar and serve using Ring, ensuring they have proper cache headers, and add cache busting query string to script/link urls. Works fine for smaller apps (like intranet apps or such).
I was looking for some assets pipeline to take case of the path and other stuff like appending the checksum to the name etc
@lxsameer all I know of is https://github.com/circleci/stefon
@deas @dnolen Looks like updating devcards to use global-exports and support node_modules requires at the same time updating sablono, om and rum, and I fear all these updates will be breaking, reagent is currently only lib with support for this
And all these libs will require Cljs 1.9.854 after the update
@juhoteperi I don’t see how it will be breaking
But using global access prevents using node modules
Hm, not sure I understand, perhaps there is difference what I refer to with breaking?
New foreign libs using global-exports work with old ClojureScript, yes
But libraries (Reagent, Om etc.) which start using (:require [react :as react])
to support both node modules and global-exports will require new ClojureScript
Devcards depends on sablono, sablono depends on om/rum/reagent (for tests, I think)
Hello, I want to ask how can I put dashes in hiccup attributes? [:div {:uk-icon "icon"}] is <div ukIcon = "icon"> because of the camelcase 😕
I'm pretty sure this has been asked before, I think the solution last time was to use data attributes ala {:data-uk-icon "icon"}
I am very thankful for this information, you saved my project. Can I ask from where do you know this, so I don't have to ask any more trivial questions?
I haven't used UIKit, I honestly only know this because someone else asked it before
@juhoteperi had an idea about your point - we could actually use global exports in an interesting way
I am wayyyyyy out of my element here (w/r/t the JS ecosystem stuff), but I just pulled in a react component lib (react-calendar-heatmap) using npm-deps
in cljs 1.9.908 and found that I needed to use it via (.-default CalendarHeatmap)
instead of just CalendarHeatmap
. This seems to have something to do with one of the many JS module export approaches? Did I / they do something wrong here or is this just one of the rough edges of the new npm-deps
support?
@anmonteiro ^ I can’t remember, is this expected?
@cap10morgan I don’t really understand what you’re saying. can you post a snippet of your importing + usage of that module?
you totally need to use .-default
@cap10morgan but you can use CalendarHeatmap/default
no need for interop there if you’re consuming a node module
hmm, CalendarHeatmap/default
didn't work
my require line is (:require ["react-calendar-heatmap" :refer [CalendarHeatmap]])
which was my attempt at translating this JS: import CalendarHeatmap from 'react-calendar-heatmap';
OK, will try that
no need for string too
Any dirac devtools users around here? I can't seem to get it working. The dirac window will open, but it doesn't have any files in the sources and no output in the console.
@anmonteiro without the string it tries to goog.require react_calendar_heatmap
and fails (underscores vs. hyphens)
Console output. (Of Chrome Devtools in the Dirac Devtools window): http://sprunge.us/PBdN
@cap10morgan I don’t believe you
if that’s happening it’s because the module wasn’t correctly processed
@cap10morgan it should work, you should only need strings if it’s not a valid symbol - if you can find a case that doesn’t work it’s a bug
OK, I'll dig further and report an issue if necessary
@cap10morgan as I said above, happy to look at a snippet of your importing + usage of that module
would probably clear out any confusion
and save you some time
@anmonteiro cool, thanks. I'll get that up and linked here shortly.
@cap10morgan the goog.require
is not going to be for a munged thing like that - Google Closure generates a name
I'm running with the latest chromium beta version. I couldn't build the dev. (Version 59.0.3071.86 (Developer Build) (64-bit))
@cap10morgan you may also wanna use :language-out :es5
or default
will be munged to default$
@ghopper http://59.xxx has no chance to fly, https://github.com/binaryage/dirac/blob/master/docs/faq.md#why-should-i-use-recent-chrome-canary-with-dirac-devtools
@darwin Where do you see what version is required specifically?
That makes sense. I'll work on getting a more recent dev version.
@ghopper each release has links to likely working chromium builds: https://github.com/binaryage/dirac/releases/tag/v1.2.15
Cool, thanks!
@anmonteiro https://github.com/democracyworks/elections-viz/blob/master/src/cljs/elections_viz/calendar_heatmap.cljs <- the non-working example w/ a symbol in the require vector. that along with the cljsbuild settings in project.clj should be all of it (and the main-panel
component is referenced from the views
ns).
oh, nevermind, it's not the symbol vs. string in the require (as you said). I'll push up my working example here. would love to know where I'm being non-idiomatic w/ it, though.
that's pushed
@cap10morgan I got it compiling locally
but..
I think you won’t be able to use this from node_modules
for now
I think Closure doesn’t understand the UMD pattern that the module exports
@anmonteiro I see. So is my working example an accident?
@cap10morgan wait, your example is working?
my most recent push, yes
it’s probably an artifact of having a global React
😛
if you were also consuming react
from node_modules it woudn’t work
@darwin Alright, I got a newer version. Any idea about these?
Internal Dirac Error TypeError: target.pageAgent(...).setAdBlockingEnabled is not a function
Internal Dirac Error TypeError: Cannot read property '_createLiveLocation' of undefined
Internal Dirac Error TypeError: Cannot read property '_createLiveLocation' of undefined
Internal Dirac Error TypeError: Cannot read property 'element' of undefined
Internal Dirac Error TypeError: Cannot read property 'element' of undefined
Internal Dirac Error TypeError: Cannot read property 'element' of undefined
Internal Dirac Error TypeError: Cannot read property 'element' of undefined
OK, yeah, I added that b/c I was getting an error about it not finding react
so perhaps worth making a note that the code may break if / when you move to consuming react from node_modules
@anmonteiro is there a less brittle way to consume this library for now?
use the bundle as a foreign library
i.e.copy node_modules/react-heatmap/build/index.js
to a place in your repo
and add [{:file "path/to/react-heatmap/build/index.js" :provides ["heatmap"]}]
to your foreign-libs
in compiler opts
OK, thanks!
@cap10morgan you can also add :global-exports '{whateverGlobalTheLibProvides react-heatmap}
to the foreign lib entry
and keep your nice, idiomatic require
great
@cap10morgan here’s what I’m referring to https://clojurescript.org/news/2017-07-30-global-exports
@anmonteiro I am trying out the fix to https://dev.clojure.org/jira/browse/CLJS-2326 , using master I get the error No input matching "bootstrap"
when attempting to (require [bootstrap])
. I still get the same Assert failed: cljs.analyzer/foreign-dep? expected symbol got ...
when trying other paths. Were you able to require bootstrap with that fix on your side?
we do have tests for that though, and they’re passing…
I’m happy to look at a minimal failing case but I would check that you’ve cleaned your build first and are actually running ClojureScript master
@anmonteiro ok, thanks, will continue to look for a possible issue on my side
@anmonteiro seems to fail when used with modules, repro here: https://github.com/symfrog/cljs-2326-repro/tree/master