Fork me on GitHub

In chromex Is there a way to add a css file to the content-script in the manifest.edn? Its possible to do in the standard chrome-extension with something like:

"content_scripts": [
      "matches":    [""],
      "css":        ["fix.css"],
      "js":         ["script.js"]
I've manually updated the manifest json like:
 [{"css": ["re-frame-modal.css"],
   ["out/content-script.js", "out/cljs-runtime/goog.debug.error.js",
And that works But I've tried a few things in manifest edn like:
:content-scripts {:css ["re-frame-modal.css"]}
But that generates slightly malformed manifest.json
  ["out/content-script.js", "out/cljs-runtime/goog.debug.error.js",
The chrome extension import doesn't like that


have you seen such datastructure in ClojureScript : #object[DOMException NotFoundError: Requested device not found]


It's just how CLJS prints some JS objects, in this case DOMException.


problem is that I am sending this via EDB to CLJ server and can not read there. I guess I have to register some tagged literal reader here


So #object[whatever] would read as a string?


what would you suggest?


Wait. Why do you send this over the wire in the first place?


I save logs in the server side - for later


Serialize the exception properly, not just with prn, and then send the serialized data over.


Perhaps you should serialize all exceptions in the same manner that doesn't remove any information from them.


The original string that you posted does not contain any useful information at all.


how would you serialize the exception?


There's clojure.stacktrace, but you should definitely ask about it in #clojure - I think there were some better options that give you the data itself and allow you to control the serialization process.


I just realized that in CLJS the exceptions are very different from CLJ. I'd probably use something like or JSON.stringify(err, Object.getOwnPropertyNames(err)).

paul a14:02:25

unfortunately, the shadow-cljs built-in macro for slurping files at compile time isn't good enough, because i need to read bytes (not UTF-8) from my file. i've defined a CLJC namespace containing my slurp-bytes macro, but now it doesn't seem straight forward to require that CLJC code in my CLJS code; instead, i'm getting this pretty much inscrutable error message, without a stack trace: Error in phase :compilation

paul a14:02:18

i guess i'll take this to #shadow-cljs


happy to announce a powerful data -> UI resolver I've been working on for a while:

👍 12

Hello! 🙂 I’m using clojurescript with reagent and figwheel ( I’m trying to add routing to my application with secretary, using dispatch! it’s everything working fine but I wanted to react to the URL, so I’ve added a ring_handler option and created a proper handler:

(ns pets-manager.server
   [clojure.string :refer [starts-with?]]
   [ring.middleware.resource :refer [wrap-resource]]))

(defn- wrap-default-index [next-handler]
  (fn [request]
     (if (or (starts-with? (:uri request) "/css/")  ;; default directory layout after doing
             (starts-with? (:uri request) "/js/"))  ;; `lein new figwheel my-app`
       (assoc request :uri "/index.html")))))  ;; wrap-resource will find index.html for us

(def handler
  (-> (fn [_] {:status 404 :body "static asset not found"})
      (wrap-resource "public")
but when I try to access any routing (like /pets) I get the 404 error (static asset not found) can you spot what am I doing wrong?


here is the repo in case you wanted to check it out:


:resource-paths ["public"] means that index.html is available at "/index.html" (wrap-resource "public") will make the server look for assets on "public/..." , not on "/...." (wrap-resource ".") does the trick, but that looks like a weird setup. Is this from a template?


actually I have a public folder at the same level of my project.clj and inside it there is the index.html that loads my builded script


Is it on the repo? If so, that's what I've tested against


yes, it is on the repo


hmm, it worked, but I didn’t understand exactly why


The server looks for resources on the classpath, not on project folders. (wrap-resource "public") says that the html resources are inside a "public" folder on the classpath But index.html is available on the "root" of the classpath, per :resource-paths ["public"]


:resource-paths ["public"] adds the contents of public to the classpath, not "public" itself - just like :source-paths ["src"] adds the contents of "src", but not the folder itself.


Oh, I’ve got it 🙂 thanks!

🎉 4

Now I just have to look how to initialize secretary with the browsers URL on the page load

☝️ 4

thank you very much


hahaha! do you speak portuguese?

😉 4

Hi, can I bother you with one more question?


I’m trying to make a router work with an re-frame application, but I’m not sure yet how do I make something like react-router with clojurescript, anyone that can help with? I tried to use secretary and now I’ve changed to re-frame-routing that uses bidi and pushy under the hood, but I still couldn’t make it work The problem is that I couldn’t sync secretary’s dispatch! with browser’s url, I was able to route the application internally but the route doesn’t reflect on the browser URL, and if I try to change the URL manually (like a href’s link) the page reloads


I'll open by saying that I'm not too fond of react-router's model - redux-first-router is a much nicer experience if you're already using redux. In the same vein, I'd look into [kee-frame](, which puts the url in the "driving seat" so to speak. For url and history sync, common libs are [pushy]( and/or [accountant]( You have to plug your router into them, but that's usually straightforward. It might also be useful to check SPA re-frame templates, as they probably have ironed out most of the kinks you are running into!


Thanks for the help again, I’ve already saw some people recomending kee-frame, but sine I’ve just started using clojurescript I rather not to use so much higher level abstractions. Since re-frame is a well known and stablished framework I’ve wanted to learn how it works before using some abstraction on top of it


That said, I’ll look into pushy and accountant, thank you 😄

👍 4