This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-18
Channels
- # announcements (43)
- # aws (28)
- # babashka (32)
- # beginners (80)
- # calva (13)
- # chlorine-clover (2)
- # cider (11)
- # clj-kondo (15)
- # cljs-dev (1)
- # clojure (151)
- # clojure-dev (11)
- # clojure-europe (11)
- # clojure-italy (3)
- # clojure-losangeles (3)
- # clojure-nl (4)
- # clojure-spec (20)
- # clojure-uk (58)
- # clojured (3)
- # clojuredesign-podcast (2)
- # clojurescript (37)
- # core-async (4)
- # core-typed (1)
- # cursive (53)
- # datascript (5)
- # datomic (26)
- # duct (23)
- # emacs (3)
- # fulcro (22)
- # graalvm (1)
- # jobs (2)
- # joker (11)
- # juxt (24)
- # lumo (1)
- # mid-cities-meetup (2)
- # nyc (1)
- # off-topic (54)
- # parinfer (1)
- # reagent (13)
- # shadow-cljs (16)
- # sql (9)
- # tree-sitter (9)
- # vim (9)
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:
"content_scripts":
[{"css": ["re-frame-modal.css"],
"js":
["out/content-script.js", "out/cljs-runtime/goog.debug.error.js",
"out/cljs-runtime/goog.dom.nodetype.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
"content_scripts":
{"css":["re-frame-modal.css"],
"js":
["out/content-script.js", "out/cljs-runtime/goog.debug.error.js",
"out/cljs-runtime/goog.dom.nodetype.js",
The chrome extension import doesn't like thathave you seen such datastructure in ClojureScript : #object[DOMException NotFoundError: Requested device not found]
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?
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.
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 https://www.npmjs.com/package/serialize-error or JSON.stringify(err, Object.getOwnPropertyNames(err))
.
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
happy to announce a powerful data -> UI resolver I've been working on for a while: https://www.reddit.com/r/Clojure/comments/f5ur6a/root_recursive_ui_resolution/
Hello! 🙂 I’m using clojurescript with reagent and figwheel (https://github.com/bhauman/lein-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
(:require
[clojure.string :refer [starts-with?]]
[ring.middleware.resource :refer [wrap-resource]]))
(defn- wrap-default-index [next-handler]
(fn [request]
(next-handler
(if (or (starts-with? (:uri request) "/css/") ;; default directory layout after doing
(starts-with? (:uri request) "/js/")) ;; `lein new figwheel my-app`
request
(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")
wrap-default-index))
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: https://github.com/ashton/pet-manager
: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
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.
Now I just have to look how to initialize secretary with the browsers URL on the page load
thank you very much
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](https://github.com/ingesolvoll/kee-frame), which puts the url in the "driving seat" so to speak. For url and history sync, common libs are [pushy](https://github.com/kibu-australia/pushy) and/or [accountant](https://github.com/venantius/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