This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-11
Channels
- # announcements (3)
- # aws (3)
- # babashka (79)
- # beginners (105)
- # calva (10)
- # chlorine-clover (22)
- # clj-kondo (12)
- # cljs-dev (39)
- # clojure (52)
- # clojure-europe (1)
- # clojure-spec (15)
- # clojure-uk (12)
- # clojurescript (47)
- # conjure (93)
- # data-science (1)
- # datomic (10)
- # emacs (6)
- # figwheel-main (14)
- # fulcro (30)
- # instaparse (3)
- # kaocha (2)
- # lambdaisland (3)
- # malli (2)
- # meander (6)
- # off-topic (27)
- # pathom (14)
- # perun (1)
- # reagent (15)
- # shadow-cljs (69)
- # slack-help (2)
- # spacemacs (5)
- # test-check (23)
- # vim (9)
does anyone know if weavejester/hiccup has something similar to re-agent’s [:<>]
? I know it’s not a react lib (there’s no concept of fragments), but I have cases like this:
(def content
[:div ;; <- I am forced to wrap it in a div, otherwise hiccup complains
[:li "one"]
[:li "two"]
[:li "three"]])
(html5
[:ul content])
I can of course do it this way:
(def content [[:li "one"] [:li "two"] [:li "three"]])
(html5 [:ul (map identity content)])
But I don’t like it this way(require '[hiccup.compiler :as compiler])
(deftype Fragment [coll]
compiler/HtmlRenderer
(render-html [_]
(compiler/render-element coll)))
(str (hiccup/html [:div (Fragment. [:ul [:li "one"] [:li "two"]])]))
"<div><ul><li>one</li><li>two</li></ul></div>"
(defn <> [coll] (Fragment. coll))
#'user/<>
user> (str (hiccup/html [:div (<> [:ul [:li "one"] [:li "two"]])]))
"<div><ul><li>one</li><li>two</li></ul></div>"
or just a simple reify:
user> (page/html5
[:div
(reify compiler/HtmlRenderer
(render-html [_]
(compiler/render-html [:ul [:li "one"] [:li "two"]])))
[:h3 "stuff"]])
"\n<html><div><ul><li>one</li><li>two</li></ul><h3>stuff</h3></div></html>"
I have an issue with figwheel-main, but #figwheel-main has considerably less users than this one. I am therefore reposting my question here: I am getting a lot of unwanted log information after I start my figwheel application. It seems to comes from the underlying figwheel http server. The log level is huge and I'm not interested in any of it. The origin namespace is `org.eclipse.jetty`
Configure your logger to ignore that namespace. For example with timbre you can use the :ns-blacklist
option.
Hi, I am not using timbre, but I guess figwheel-main might use it. How do I configure it?
I think figwheel uses java.util.logging or something like that. There must be a way to configure whatever it is using, but I'm afraid I can't give any exact pointers right now.
Thanks a lot, I'll ask in the figwheel github page
in re-frame parlance, would an on-change
event on an input that causes things to be drawn on a canvas on the page be best achieved by https://github.com/day8/re-frame/blob/master/docs/Effects.md?
Yes. Unless it's an input that's very tightly coupled with the canvas, and for a very good reason. Then I'd treat them as a single component.
what does clojurescript development look like without figwheel or shadow? anyone have a representative repo somewhere? Wondering where compiler options and build is put. and repl environment look like
not sure exactly what you’re looking for. I’ve used lein cljsbuild https://github.com/emezeske/lein-cljsbuild before if you just want “refresh the page” development. repl support isn’t included. fwiw, I’ve also used figwheel sidecar for a programmatic interface to figwheel to do some fancier stuff, https://github.com/bhauman/lein-figwheel/tree/master/sidecar
something like:
(ra/start-figwheel!
{:build-ids ["dev"]
:all-builds
[{:id "dev"
:source-paths ["src"]
:figwheel {:on-jsload "app.core/on-js-reload"}
:compiler {:main 'app.core
:asset-path "js/compiled/out"
:output-to "resources/public/js/compiled/app.js"
:output-dir "resources/public/js/compiled/out"
:source-map-timestamp true}}]})
It’s been a while since I worked on it, but I had a number of examples with different REPLs here: https://github.com/potetm/tire-iron/blob/master/src/dev/build/user.clj
it goes into the deps.edn, right? https://github.com/clojure/clojurescript/blob/master/deps.edn https://clojurescript.org/guides/quick-start
@dpsutton if you're using ClojureScript directly you're probably using cljs.main
you can supply build options in edn files
if you've used figwheel-main
it's really not that different, figwheel-main
is modeled on cljs.main
FWIW, for web I use figwheel-main
because it just does a bunch of nice things that the standard browser REPL doesn't
i'm looking at build.api
and then throwing that into webpack. just learning all the raw tools so i understand how they can/should compose
build.api
is useful, but I rarely use it now cljs.main
can do nearly all typical tasks, and deps.edn
aliases can make typical commands quite short
you don't use nrepl/piggieback i take it? static analysis in cursive and raw terminal there?
at some point I'd like to make the standard broswer REPL a bit more capable - but the existence of Figwheel just makes that a low priority - about the only time browser REPL gets worked on is if we're updating the docs so beginners and I see an area for improvement if you just want get the basic idea
I haven't used nrepl / piggieback for many, many years - no offense but I found that stuff to fragile and opaque many years ago
that + Emacs inf-clojure, and Cursive have worked great for me and when things go wrong there's nothing in between me and the failure
one thing that's not quite been very clear is that cljs.main
has been extensible for a quite some time - there were a couple of issues but I just fixed most of those and they'll be in the next release
it's pretty easy to write a custom build tool in a couple of hundred lines and you can literally reuse all of cljs.main
+ your extensions
My hesistation has been towards the use of npm deps. And it sounds like that objection will be going away soon
Anyone know how to access HTML elements in cljs and set their inline style dynamically?
Trying to do something like this but in cljs
(.-style (first (array-seq (.getElementsByClassName js/document "vector-bar"))))
This is how I’m trying to get at it
But all I’m seeing is this as a response
#object[CSSStyleDeclaration [object CSSStyleDeclaration]]
Any way to change the CSS inside the style map through cljs js interop or am I stuck?
It’s been a while since I worked on it, but I had a number of examples with different REPLs here: https://github.com/potetm/tire-iron/blob/master/src/dev/build/user.clj