This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-08
Channels
- # 100-days-of-code (1)
- # announcements (7)
- # beginners (63)
- # cljs-dev (39)
- # clojure (78)
- # clojure-dev (40)
- # clojure-italy (4)
- # clojure-nl (22)
- # clojure-russia (5)
- # clojure-spec (5)
- # clojurescript (60)
- # cursive (8)
- # datomic (6)
- # emacs (1)
- # figwheel-main (53)
- # fulcro (19)
- # jobs-discuss (11)
- # mount (1)
- # off-topic (3)
- # om (1)
- # pedestal (9)
- # philosophy (1)
- # re-frame (19)
- # reagent (4)
- # reitit (5)
- # shadow-cljs (66)
- # tools-deps (64)
How can I do a binding
with shadow cljs?
Ok. I was avoiding clj-run and leveraging build hooks.
Could I wrap the build-state of a build hook with it?
hmm yea just took another look and realised
So the dynamic variable binding should be avoided to keep it to build hooks and keep caching then?
Yea this is the SSR implementation being worked on.
I'm looking to leverage it in shadow-jam and just figuring out how I can leverage that SSR.
I probably need to have a closer look at the caching situation then as well because I perform image manipulation and generate multiple image files in macros.
There isn't really any other way for me to perform it from what I can tell.
It's the macro I use here. https://github.com/groundedSAGE/shadow-jam/blob/master/src/routes/index.cljc#L14 that I am referring to.
Allows defining a source image and other details which it then uses to grab image, collect certain metadata, use that metadata to figure out data required for the html markup and generates corresponding assets.
so the basic misconception I see it that you think everything has to happen in the macro
I thought it through and discussed with others and apparently macro was only way. I try and avoid macros as I know the objective is data > fn > macro
[:picture [:source {:srcset (your.lib/get-path "some.jpg" :small) :media "..."}]] [:img {:src (your.lib/get-path "some.jpg")}]]
(defn get-path [img-name img-variant] (goog.object/get js/myImages img-name (name img-variant)))
a) generate it statically since you know which images you have and then append it to the final build output
It's actually
[:picture [:source "various responsive sizes"] [:source "the same thing again but fallback image format"] [:img "the image again which contains more metadata and fallback"]]
Ah yes slow typing. Apologies.
the other option is to actually employ a macro but only store which images where accessed and which variants
so basically the concept is to use a helper function that can return data that was not part of the CLJS compilation at all
building a system that can generate all the images you want into a macro is just gonna be painful to use for everyone
I kind of see what you mean with the helper functions. For me right now the macro seems easier to grok. I'm just working to bring this up to a gatsby like experience (through stealing ideas) then hopefully people with more dev chops can chime in and help me polish it lol.
I've print screened your explanations. Brain a bit foggy as is late here now.
I'm a bit too busy with other stuff but hooking image processing and scss into shadow-cljs is on my list
I'm interested to see your image processing implementation when done and see how much more I have to learn 😛