Problem with shadow-cljs and github pages

Hi all,
I’m having problems making a project built with shadow-cljs work with github pages.
I put this project on github: https://github.com/vipenzo/faber. It’s a simple clojure editor that let you write clojure code to create 3d models that are, once compiled, visualized in a three.js pane.
It does work locally (just a minimal set of primitives for now), but I would like to make it work live using github pages. I configured the project for pages and it is available at the address “https://vipenzo.github.io/faber/”.
The problem is the github pages server routing system that it is quite obscure to me: my web files (html, css, js) are all available from the prefix https://vipenzo.github.io/faber/ but the real root seems to be “https://vipenzo.github.io/”.
So, for example, if in my index.html file I write “” the server tries to load it from “https://vipenzo.github.io/css/codemirror.css” (faber is missing). I had to remove the “/” to load this file relative to the index.html position to make it work (so it is now ).
No big deal, so far, but I cannot make this kind of intervention on files loaded by shadow-cljs. For example one of the first files loaded is “https://vipenzo.github.io/js/bootstrap/index.transit.json” which should instead be “https://vipenzo.github.io/faber/js/bootstrap/index.transit.json”, but I don’t know how to configure shadow-cljs to obtain this.
I tried with :asset-path “faber/js” but it seems to have no effect on the :bootstrap target.

I’m probably just using a wrong approach for this, if someone can offer some help I would really appreciate.

You can pass the path to use to the boot/init call.

See my the example code from my post.

(defn start []
  (boot/init compile-state-ref
    {:path "/bootstrap"}
    compile-it))

:path defaults to /bootstrap if not passed in.

It works !
Thanks a lot.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.