This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-05-07
Channels
- # admin-announcements (1)
- # arachne (1)
- # beginners (11)
- # boot (72)
- # cider (7)
- # cljs-dev (9)
- # clojure (31)
- # clojure-czech (8)
- # clojure-poland (1)
- # clojure-russia (7)
- # clojure-uk (17)
- # clojurescript (48)
- # community-development (5)
- # cursive (2)
- # data-science (1)
- # datascript (3)
- # datavis (1)
- # datomic (4)
- # devcards (45)
- # docker (3)
- # hoplon (5)
- # keechma (3)
- # lein-figwheel (1)
- # leiningen (4)
- # luminus (16)
- # off-topic (1)
- # om (2)
- # om-next (1)
- # onyx (4)
- # other-languages (104)
- # overtone (1)
- # re-frame (2)
- # reagent (37)
- # rum (35)
- # untangled (4)
- # yada (4)
Hello! Is it possible to setup my project in such a way that devcards are created alongside the rest of the application? I'd like to have a route "/devcards" that would serve a devcards.html where the devcards are mounted.
Looking at the devcards-template, I get the feeling that the intended workflow is that I start with lein figwheel devcards
if I want to use devcards, and then switch to lein figwheel dev
if I want to use the actual app.. but that can't be right
What logic does devcards use for.. mounting itself? It feels like it just attaches itself to the page
I mean, I'm used to having a `<div id="app"></div>" somewhere, and then mounting the entry point there client-side
I've been using clojure for a year now, but this is the first time I'm actually starting a project from scratch by myself, so I'm a bit lost still. but making progress! 😄
Woot, seems to work. Though the actual card doesn't show up. Should devcards work with Rum?
(rum/defc input < rum/reactive [ref]
[:input {:type "text"
:value (rum/react ref)
:style {:width 100}
:on-change #(reset! ref (.. % -target -value))}])
#?(:cljs
(defcard (controls)))
The documentation for defc says: "Defc does couple of things:
1. Wraps body into sablono/compile-html
2. Generates render function from that
3. Takes render function and mixins, builds React class from them
4. Using that class, generates constructor fn [params]->ReactElement
5. Defines top-level var with provided name and assigns ctor to it
Usage:
(defc name doc-string? [< mixins+]? [params*] render-body+)"(ns frontendfi.views.controls
(:require
[rum.core :as rum])
#?(:cljs
(:require-macros
[devcards.core :as dc :refer [defcard deftest]])))
This is my ns declarationAll this time I've just been staring at the server-side rendered components that don't actually do anything, without realising I specifically disabled mounting the rum components so that I see the server-side rendering is working
Hmm, if I require devcards in the components file, what can I do to not include in a production build?
I defined devcards as a development dependency in my project.clj, but lein uberjar
fails now
I know I could define the cards in a separate file, and in a production build that file could be empty