This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # beginners (6)
- # calva (1)
- # cider (17)
- # clj-kondo (10)
- # clojure (4)
- # clojure-austin (3)
- # clojure-spec (3)
- # clojurescript (40)
- # clojurex (17)
- # core-async (10)
- # cursive (1)
- # data-science (2)
- # datomic (15)
- # emacs (10)
- # fulcro (15)
- # funcool (1)
- # graalvm (15)
- # joker (3)
- # nrepl (34)
- # off-topic (10)
- # pedestal (3)
- # rewrite-clj (6)
- # spacemacs (5)
- # sql (11)
I am trying to use
shadow-cljs like this
But I am getting
clojure (ns starter.core (:require [reagent.core :as r] ["slate-react" :refer (Editor)])) (defn app  [:> Editor]) (defn start  (js/console.log "Starting...") (r/render [app] (.getElementById js/document "app")))
documentis undefined error
Hello, This weekend I started playing with shadow-cljs because I would like to use firebase, but I have a problem with static resources. I have another lein project that generates and bundles css files, fonts, images. I would like to use these resources in my shadow-cljs app, but it doesn’t seem to work. If I look in the jar files of the library, I can see all my resources, but if I reference the css in my index.hml, it doesn’t find it. Is this a limitation of shadow-cljs or am I missing something? Thanks.
Yes, I see it, also the functions defined in the library can be called from the shadow-cljs app
I'm assuming you're using the default dev http server. Your static resources need to be wherever your folder that's being served is (e.g.
resources/public in your app)
If you are serving it from your own webserver, you'll need to set it up so that it will serve those static files from the classpath
Another would be to create your own Clojure web server to serve your files instead of using Shadow's built in one
If you're going to e.g. copy the built app to some static host (s3 or whatever), then I would create a function to copy those files from the classpath into the directory of files you're going to upload
If you were going to deploy it as part of a server side Clojure application, then I would setup that application to resolve static resources to those resources on the classpath
But shadow can't assume that you want to serve or deploy every file that shows up on the classpath. That could be potentially insecure, and fraught with gotchas and errors
Thanks for the reply. I would like to deploy to firebase hosting, so my own server is not an option. How do other component libraries solve this? My point of having this other library was to reuse components and logo's, ... I can't imagine that I am the only one with this problem.
but this is obviously only development-time setup, as @lilactown wrote, for deployment you probably don’t want to use anything like shadow-cljs dev server
CLJS libs typically don't distribute static assets. With npm libs, it's best to copy the files from node_modules
Are you saying that I could make the target of the library a npm package with resources?
You could do that but you'd have all sorts of other issues, and it wouldn't solve your current problem
So if cljs libs don't have static resources, how do clojurescript component libraries have there own css resources bundled?