Open Ramblurr opened 4 months ago
It seems the static stuff isn't necessary for just running the notebook locally. To get it running locally I had to:
ee0248bbc1054476e781e25b11414fa9899050b9
package.json
to my ownnextjournal.clerk.static-app
from shadow-cljs.edn
clojure -A:dev
to launch the replThen I was easily able to load cljs libraries (Quil in my case) in the cljs file and render them, very nice! :tada:
Unfortunately building the static app is still out of my reach. Running bb build-static
results in
Execution error (StringIndexOutOfBoundsException) at jdk.internal.util.Preconditions$1/apply (Preconditions.java:55).
Perhaps you can debug what is going wrong in subs
, it could be an off-by-one error or so :)
Yup, just did that. That's what I get for posting to github before troubleshooting myself.
The problem with subs
was that the repo I was doing this from was git init
ed but had no commits, so it couldn't find the latest sha.
Now the static app is building, but fails to load in the browser:
Uncaught ReferenceError: nextjournal is not defined
I suspect that has to do with the changes in this commit that removed nextjournal.clerk.static-app
Replacing nextjournal.clerk.static-app
with nextjournal.clerk.sci-env
in shadow-cljs.edn didn't sort that out..
Huzzah! It's working again.
After generating the template:
ee0248bbc1054476e781e25b11414fa9899050b9
(which is the latest as of 2024-05-27)package.json
to the generated package.json
nextjournal.clerk.static-app
from shadow-cljs.edn
's :entries listnextjournal.clerk.sci-env
and nextjournal.clerk.trim-image
to shadow-cljs.edn
's :entries listnpm install
bb clerk-watch
and bb build-static
Step 2 is really quite unfortunate. @sritchie @zampino is there anyway around adding all the clerk npm deps to the project?
@Ramblurr shadow should be doing that automatically for you, that's a bummer.
fwiw, this was my latest attempt at a template that tries to smooth over these edges: https://github.com/mentat-collective/clerk-utils/tree/main/resources/clerk_utils/custom
I haven't used the one in this project in a while so I'm not sure if the clerk-utils template will help. But give it a try as another option.
Unfortunately this template is broken in various ways, it doesn't work out of the box like the README seems to suggest it would (though I could be misunderstanding).
More importantly however the
nextjournal.clerk.static-app
ns was removed here so it won't work with newer versions of clerk.