Devcards aims to provide a visual REPL experience for ClojureScript
bhauman 2015-10-05T00:33:45.000008Z

Added some more devcards documentation:

bhauman 2015-10-05T00:35:33.000011Z

@darwin: I'd look at the IDevcardOptions protocol in the docs above

bhauman 2015-10-05T00:35:45.000012Z

lets you override the path


@bhauman: thanks a lot, will revisit my code soon-ish


@bhauman: while you are at documenting things, I would really appreciate some doc on how to build my initial data only if defcard is going to be displayed - for example look at defcard reagent-support here!/devdemos.core, what if building re-bmi-data is a heavy-weight operation? I want to build it only if the card is going to be displayed. Maybe passing a function there?

bhauman 2015-10-05T14:53:16.000018Z

@darwin you can defonce an ratom and pass that in as your initial data

bhauman 2015-10-05T14:54:07.000019Z

@darwin you can also defonce initial data (a map) and pass that in as well


ok, that would work for figwheel-workflow, but what if I want to do a full refresh for some reason, then I get all the heavy objects from all cards re-created


the issue for me wasn’t really speed, but debug logging


I wanted to focus on one card and ignore others for a while


had to comment-out all my other cards


or push the init code into render function of the component as a quick hack

bhauman 2015-10-05T15:14:12.000025Z

@darwin: well that seems like the cost of doing business right.

bhauman 2015-10-05T15:14:39.000026Z

@darwin: but you can focus on one card though, by clicking the heading


that is what I did, but all namespaces get loaded and all init code runs


I would like to have some way how to build init data on-demand, only when devcard is going to be displayed


not sure about tests tough,


they also run all the time I guess

bhauman 2015-10-05T15:18:12.000031Z

@darwin: there is a figwheel client side flag that isn't documented called :reload-dependents

bhauman 2015-10-05T15:18:26.000032Z

@darwin: tests only run if the card is mounted

bhauman 2015-10-05T15:18:49.000033Z

if you set that flag to false then the other ns won't be loaded every time


hm, I will look for some solutions, maybe my workflow was broken, I didn’t use figwheel for this, because my atoms weren’t updated on change for some reason, so I had to do full refreshes


but still the thing that all my devcard init code runs even if I just directly view one devcard is not optimal

bhauman 2015-10-05T15:21:10.000036Z

@darwin: here is what you can do


I had situations where I broke my code, and wanted to fix it on one particular card, but all were broken giving me hard time debugging it

bhauman 2015-10-05T15:21:48.000038Z

just create an a react component that initializes your data when it's mounted

bhauman 2015-10-05T15:22:20.000039Z

Have it take a function

bhauman 2015-10-05T15:22:38.000040Z

then make that the first card on the page

bhauman 2015-10-05T15:23:36.000041Z

This is also a good solution for your app. Top level init isn't very good. Enclosing this stuff into a component gives you much more control


ok, will try to something like this, will rewrite my stuff with IDevcardOptions anyway, it will be good opportunity to revisit this


thanks for the hints

bhauman 2015-10-05T15:25:08.000044Z

there is also Stuart sierras component which works in CLJS now


want to use it, just saw his talk from StrangeLoop few years back


need to rewrite most of my defs this way

bhauman 2015-10-05T15:28:21.000048Z

but react comps work as well or better

bhauman 2015-10-05T20:06:07.000049Z

@meow: Just letting you know my strategy for creating a devcards website. Create an index.html at the root of my repository that references built assets in the resources dir. And then create a gh-pages branch from master.

bhauman 2015-10-05T20:07:35.000051Z

The every so often build the website build and merge it into gh-pages

bhauman 2015-10-05T20:07:50.000052Z

gh-pages is simply a mirror of my master

shaun-mahood 2015-10-05T21:16:42.000054Z

@bhauman: I've started using devcards for building out project and technical requirements, it's working really well for it. I prefer it to pretty much all the alternatives I've tried, including markdown based editors, bug trackers and project management software . Just feels so freeing to be able to extend things as far as I want and have everything respond so quickly to changes.

bhauman 2015-10-05T21:19:34.000055Z

@shaun-mahood: Thats good to hear :simple_smile: Yeah live code and docs together is pretty expressive. I'm glad you are having fun with it.

bhauman 2015-10-05T21:20:10.000056Z

@shaun-mahood: I'm pretty busy updating the docs

shaun-mahood 2015-10-05T21:23:38.000057Z

I'm mostly surprised at how nice it is to use it for the simplest things using just defcard and deftest, without anything complex. Docs are definitely coming along too, it's way more understandable and the case for it seems much clearer than when it was first announced.

shaun-mahood 2015-10-05T21:24:19.000058Z

I have a bunch of work coming up that's outside of clojure / cljs and I'm already feeling depressed about it.

bhauman 2015-10-05T21:31:36.000059Z

darn, sorry to hear that

shaun-mahood 2015-10-05T21:37:47.000060Z

I've got plans for eventually getting it all moved over. May be rebuilding one of the apps sooner than later into cljs, so that part will be fun.