devcards

Devcards aims to provide a visual REPL experience for ClojureScript https://github.com/bhauman/devcards
2015-09-08T13:25:56.000003Z

I’m trying to integrate devcarsd into my existing project, it looks like I’m missing something, the devcards UI is not rendering, I tried to dig into sources a bit and I don’t understand who is responsible for calling start-devcard-ui! or start-ui

2015-09-08T13:26:41.000004Z

I see bunch of exported functions, is it supposed to be called by figwheel running in the same javascript context?

ericstewart 2015-09-08T13:35:32.000005Z

@darwin: I think I’m only one step ahead of you (trying to integrate into an existing project). I believe you are responsible for calling start-devcard-ui! and the recommendation seems to be to have a cljsbuild specifically for devcards

ericstewart 2015-09-08T13:36:00.000006Z

I’m at the point of getting the ui to show (when I call start-devcard-ui!) but can’t get any cards to show up

2015-09-08T13:36:20.000007Z

@ericstewart: that’s what I did, I followed the docs, I think my problem is that for some reason figwheel is not present in my page

2015-09-08T13:36:48.000008Z

I have a feeling that figwheel is responsible for driving devcard’s UI, for added dynamism

2015-09-08T13:37:00.000009Z

when namespaces are defined or go away

ericstewart 2015-09-08T13:37:17.000010Z

I don’t think figwheel is required though

ericstewart 2015-09-08T13:37:55.000011Z

I’ve been following various docs and the template project: https://github.com/bhauman/devcards-template

2015-09-08T13:38:37.000013Z

the template project works for me

2015-09-08T13:39:00.000014Z

and it has figwheel and no start-ui calls

ericstewart 2015-09-08T13:39:36.000015Z

hmm.. I see that it does have a start-devcard-ui call…. in devcards-core.cljs

2015-09-08T13:39:42.000016Z

when I call start-devcard-ui! manually the UI gets rendered, but it is empty, it has no knowledge about my namespaces

2015-09-08T13:40:54.000017Z

hmm

2015-09-08T13:41:11.000018Z

but my generated hello-world does not have that file generated, let me double check

ericstewart 2015-09-08T13:41:12.000019Z

in devcards-core.cljs, which calls (devcards.core/start-devcard-ui!) it requires the primary core namespace

2015-09-08T13:43:08.000020Z

do you have that file in generated project? lein new devcards hello-world

2015-09-08T13:43:13.000021Z

I don’t

2015-09-08T13:43:21.000022Z

maybe I’m using some older version

ericstewart 2015-09-08T13:44:11.000023Z

hmm.. you are right… I don’t either… I’ve been mainly browsing the source in github, which is different than what I have generated too

2015-09-08T13:44:24.000024Z

and that generated piece works for me

ericstewart 2015-09-08T13:48:56.000025Z

and it is also using devcards 0.2.0-SNAPSHOT…. while running, looking at target/figwheel_temp/devcards/figwheel/connect.cljs it it getting the (devcards.core/start-devcard-ui!) call there

bhauman 2015-09-08T14:02:21.000026Z

Hey guys I getting ready to travel today and I'm behind, otherwise I jump right in here. I'll be available tomorrow for sure and I'll check back later .....

ericstewart 2015-09-08T14:03:05.000027Z

Thanks @bhauman. I think I just made a breakthrough and got it working, but need to make sure I understand what I did

2015-09-08T14:03:09.000028Z

@bhauman: thanks! but we will figure it out

2015-09-08T14:03:26.000029Z

happy travels! :simple_smile:

ericstewart 2015-09-08T14:04:05.000030Z

@bhauman: yes, good travels. And devcards seems very intriguing so looking forward to exploring this more

ericstewart 2015-09-08T14:06:39.000031Z

so, in my case I had my own call to start-devcard-ui! in my cljs source, but as you pointed out figwheel is doing this itself (presumably because we pass :devcards true to figwheel int eh cljsbuild settings. For me the devcards ui had been starting but no cards. Now when I just let figwheel do it my cards are picked up and displayed

2015-09-08T14:09:06.000032Z

@ericstewart: congrats! :simple_smile:

ericstewart 2015-09-08T14:09:11.000033Z

@darwin: in your project are you generating a separate js file for devcards as the template project does?

2015-09-08T14:09:33.000034Z

yes, this is what I did so far, but my project is more complex: https://github.com/darwin/plastic/commit/cf85285278bcc67df6eea1fcfc5fe2c439c017d1

ericstewart 2015-09-08T14:09:34.000035Z

and is that the one you are loading?

2015-09-08T14:10:22.000036Z

yes, but I have my own figwheel client config and patches, so I need to go back and start from scratch I guess

2015-09-08T14:11:11.000037Z

this is what I do to figwheel: https://github.com/darwin/plastic/blob/master/cljs/src/dev/plastic/dev/figwheel.cljs

2015-09-08T14:13:14.000039Z

I have to go now, will get back in 3 hours and then will continue, I’m pretty confident, I will be able to figure the issue out, will report back

ericstewart 2015-09-08T14:13:26.000040Z

ah, interesting. Yes, I suppose something there could be interfering

bhauman 2015-09-08T14:14:23.000041Z

Here's the secret if you don't use :devcards true in the :Figwheel config you need to put devcards true in the build options

ericstewart 2015-09-08T14:17:45.000042Z

hmm… in his code itlooks like the :figwheel options that includes {:devcards true} is in the compiler map, not the overall build configuration map…

bhauman 2015-09-08T14:26:14.000043Z

":devcards true" in the Figwheel options generates the start-ui code and propagates devcards true to the compiler config. We need devcards true in the compiler config as a switch to enable or disable the defcard macro.

2015-09-08T15:53:01.000044Z

ah, that might be it, my original :figwheel key was in :compiler of :cljsbuild profile (probably a mistake from early days)

2015-09-08T15:56:07.000045Z

great! it works like a charm :simple_smile:

ericstewart 2015-09-08T15:58:55.000046Z

great!

meow 2015-09-08T20:45:28.000047Z

Here's my devcards project if it helps anyone: https://github.com/decomplect/ive

1👍