devcards

Devcards aims to provide a visual REPL experience for ClojureScript https://github.com/bhauman/devcards
mattsfrey 2016-07-26T18:15:16.000109Z

wondering if anyone has any advice about where to locate devcards in ones project, particularly how you are sourcing the components you define in devcards into your application?

mattsfrey 2016-07-26T18:21:10.000110Z

to elaborate I am imagining having a set of dev cards that will catalog my UI components, but I'd like to be able to reference the same code when placing components in my app. Is there a way of doing this without having the same code live in two spots and having to make sure they stay in sync?

mattly 2016-07-26T19:02:15.000111Z

@mattsfrey: a, thanks for the gist. b) re your previous inquiry, for things like a styleguide, I have a dev.* namespace that doesn't get included in the "production" build but does get included in our edge builds

mattly 2016-07-26T19:03:03.000112Z

there's a few extra route handlers declared there for things like the styleguide, docs, prototypes, etc

mattly 2016-07-26T19:03:13.000113Z

it's worked fairly well

mattsfrey 2016-07-26T19:13:02.000114Z

oic

mattsfrey 2016-07-26T19:13:32.000115Z

so your actual component code does live in two files?

mattsfrey 2016-07-26T19:13:41.000116Z

and has to be reconciled somehow?

shaun-mahood 2016-07-26T19:28:31.000117Z

@mattsfrey: My usual workflow is to start off with my devcards in the same namespace as the component while designing and figuring things out, then I move it out to a dev.* namespace as needed. Where do you want your devcards to be accessible from - production, development, or separate from both?

mattsfrey 2016-07-26T19:33:56.000118Z

Maybe I'm not understanding something but I thought the devcard itself holds the component code that will be used there, basically wrapped inside a defcard etc

mattsfrey 2016-07-26T19:34:08.000119Z

but I'd want to use the component code as well inside of my app

mattsfrey 2016-07-26T19:34:19.000120Z

i.e. to place a modal or button or whatever

mattsfrey 2016-07-26T19:34:41.000121Z

which I wouldn't do with it living inside of a defcard etc?

shaun-mahood 2016-07-26T19:37:39.000122Z

@mattsfrey: I believe the general approach is to define your component outside of the card itself, then mount the component within the card so that you can work on the design/tests without needing to have the full app framework built around it. At least that's how I've been using it... I don't think it would work otherwise, as part of the appeal of devcards is that you can choose to build/render the cards or not for any build profile, so you can have them accessible at dev time but not affect anything in your production build.

shaun-mahood 2016-07-26T19:39:11.000123Z

If you look at the code on the main demos (https://github.com/bhauman/devcards/blob/master/example_src/devdemos/core.cljs), you can see that the individual components are declared using the normal defn and then those functions are used from within each card

mattsfrey 2016-07-26T19:42:34.000126Z

ohhh ok

mattsfrey 2016-07-26T19:42:45.000127Z

Yeah I wasn't looking at this correctly at all lol

shaun-mahood 2016-07-26T19:43:39.000128Z

I've been there 🙂 Bruce's talk at strangeloop is excellent if you haven't seen it yet and might help with some of the conceptual stuff https://www.youtube.com/watch?v=G7Z_g2fnEDg

shaun-mahood 2016-07-26T19:46:20.000131Z

But I think how devcards works will be a great fit for what you're trying to do in terms of a UI component catalog, it's a joy to work with.

mattsfrey 2016-07-26T19:47:13.000132Z

yeah everyone has been raving about it, I'll check the video

mattsfrey 2016-07-26T19:47:56.000133Z

thanks for being so thorough and helping me out, my slack interactions the last few days have really helped shape my testing strategy etc

shaun-mahood 2016-07-26T19:51:47.000134Z

No problem, I'm glad I could be of some help. Honestly, slack helped me through so many conceptual issues as I got started with the whole Clojure stack - there's so many new and innovative things that it was impossible for me to wrap my head around it all without help. I spent a couple years really interested in it all, been working with it all for about a year and I still feel like a beginner for much of it.

mattsfrey 2016-07-26T19:52:46.000135Z

For sure, I just started with clojure and FP in general 3 months ago so I know the feeling 🙂