This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-09
Channels
- # adventofcode (132)
- # announcements (19)
- # babashka (7)
- # babashka-sci-dev (6)
- # beginners (46)
- # calva (25)
- # chlorine-clover (5)
- # cider (2)
- # clara (17)
- # clj-kondo (93)
- # clojure (2)
- # clojure-dev (4)
- # clojure-europe (12)
- # clojure-losangeles (3)
- # clojure-nl (7)
- # clojure-uk (4)
- # clojurescript (29)
- # conjure (6)
- # core-async (8)
- # cursive (16)
- # data-science (7)
- # datomic (1)
- # exercism (4)
- # figwheel-main (8)
- # fulcro (9)
- # graphql (2)
- # helix (1)
- # introduce-yourself (3)
- # jobs (3)
- # lsp (4)
- # malli (20)
- # minecraft (3)
- # nextjournal (62)
- # off-topic (16)
- # overtone (34)
- # pathom (5)
- # polylith (10)
- # portal (1)
- # re-frame (104)
- # reagent (29)
- # reitit (1)
- # remote-jobs (2)
- # rum (3)
- # shadow-cljs (22)
- # spacemacs (2)
- # sql (10)
- # tools-deps (17)
- # vim (13)
The LA Meetup started to look at Clerk tonight and we saw some kind of odd behavior. I started up a REPL in a dummy project, required the nextjournal.clerk
namespace and then asked it to serve!
watching two folders. In my editor, whenever I saved files in those folders, the browser automatically refreshed to that file and rendered it. I didn't have to call show!
at all. That seemed really nice. However, when I tried to do the exact same thing inside the clerk-demo
project that I had checked out, that same process did not work -- I had to explicitly call show!
to get the browser to update. Another LA Meetup member had that same behavior in the clerk-demo
namespace. Which is the expected behavior? I thought the point of the watcher was to auto-reload as each file changed?
did you use this serve! call in the demo project? https://github.com/nextjournal/clerk-demo/blob/main/dev/user.clj#L9
Yes, two of us tried that, both manually from a REPL started in clerk-demo
and from a REPL-connected editor in the clerk-demo
project.
one thing I can think of is that some of the example notebooks (especially sicmutils and semantic) take quite a while to compute the first time
It worked just fine in a standalone project, using both 0.2.214
and the more recent 0.3.something release (whatever is the latest on Clojars). But nothing we tried worked in clerk-demo
I added a new foobar.clj
file in notebooks
and that got auto-rendered. Then I modified elements.clj
and that auto-rendered. I added example.clj
to src
and that auto-rendered. But changing index.md
or notebooks/introduction.clj
does not trigger auto-rendering.
I see
Clerk evaluated 'notebooks/introduction.clj' in 307.177276ms.
in the REPL but the browser view stays on the previously rendered page -- and if I refresh after saving that file, I get a blank page.I just ran this in the REPL and it still don't render the page:
user=> (clerk/show! "notebooks/introduction.clj")
Clerk evaluated 'notebooks/introduction.clj' in 284.240345ms.
nil
So it looks like some pages are broken in terms of rendering? Let me pull up dev tools...If I comment out that form, it loads, but I still get an error in the console...
I tried editing index.md
from the root of the project and that does not trigger Clerk to re-evaluate it.
None of the .md
files get automatically evaluated & rendered. Just the .clj
files. Is that expected?
OK, happy to test the fixes when they drop. I don't think I'm the target audience for Clerk though: I can't understand what I'd use it for at all.
so this works fine here for me, using 60c98a7edc2504134547aa96f829c955bc891906
of the clerk-demo
could you try if (clerk/clear-cache!)
helps if you’re already on 60c98a7edc2504134547aa96f829c955bc891906
?
@U04V70XH6 I'm hoping that after we provide more use case examples over the coming weeks you'll start to have ideas for using Clerk 🙂
I can confirm that I have also observed this issue when attempting to run a notebook watcher in a Windows directory from WSL. Autorefresh works fine on WSL/Ubuntu paths, but not Windows ones.
@UFTRLDZEW also with a js error?
@mkvlr no JS errors for me, rendering generally tends to work ok
anybody here on windows who has a few minutes to test https://github.com/nextjournal/clerk-demo on the latest main
?
About to take Clerk out for a third spin (will use the sha above) - and a thought occcurs for some distant date - could there ever be the possibility of generating slides from Clerk?
@mkvlr That version no longer even auto-renders the source files that the previous version did.
Here's my REPL session in the latest clerk-demo
checkout:
(! 534)-> clojure -M:rebel
Downloading: com/bhauman/rebel-readline/maven-metadata.xml from clojars
DEPRECATED: Libs must be qualified, change clj-time => clj-time/clj-time (/Users/sean/.gitlibs/libs/jackrusher/mundaneum/84476918ee47b66a2d6128e1a90780e52fd2ae44/deps.edn)
DEPRECATED: Libs must be qualified, change backtick => backtick/backtick (/Users/sean/.gitlibs/libs/jackrusher/mundaneum/84476918ee47b66a2d6128e1a90780e52fd2ae44/deps.edn)
DEPRECATED: Libs must be qualified, change clj-http => clj-http/clj-http (/Users/sean/.gitlibs/libs/jackrusher/mundaneum/84476918ee47b66a2d6128e1a90780e52fd2ae44/deps.edn)
DEPRECATED: Libs must be qualified, change clj-time => clj-time/clj-time (/Users/sean/.gitlibs/libs/jackrusher/mundaneum/84476918ee47b66a2d6128e1a90780e52fd2ae44/deps.edn)
DEPRECATED: Libs must be qualified, change backtick => backtick/backtick (/Users/sean/.gitlibs/libs/jackrusher/mundaneum/84476918ee47b66a2d6128e1a90780e52fd2ae44/deps.edn)
DEPRECATED: Libs must be qualified, change clj-http => clj-http/clj-http (/Users/sean/.gitlibs/libs/jackrusher/mundaneum/84476918ee47b66a2d6128e1a90780e52fd2ae44/deps.edn)
[Rebel readline] Type :repl/help for online help info
user=> (require '[nextjournal.clerk :as clerk])
nil
user=> (clerk/serve! {:watch-paths ["notebooks" "src" "index.md"]})
Clerk webserver started on 7777...
Starting new watcher for paths ["notebooks" "src" "index.md"]
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See for further details.
{:watch-paths ["notebooks" "src" "index.md"]}
user=>
and then I open a browser to localhost:7777 and it just says "Use nextjournal.clerk/show!..." and when I modify files in notebooks
or src
, they are not auto-rendered.Nope. Modifying the watched files still doesn't auto-render in the browser.
:deps {io.github.nextjournal/clerk {:git/sha "9cde5ec9ddd2f2e9d0752c7bcc4ff752c996bd04"}
that's from the updated clerk-demo
after the pull.Just to show that it did checkout that latest version:
(! 536)-> clojure -M:rebel
Checking out: at 9cde5ec9ddd2f2e9d0752c7bcc4ff752c996bd04
DEPRECATED: Libs must be qualified, change clj-time => clj-time/clj-time (/Users/sean/.gitlibs/libs/jackrusher/mundaneum/84476918ee47b66a2d6128e1a90780e52fd2ae44/deps.edn)
DEPRECATED: Libs must be qualified, change backtick => backtick/backtick (/Users/sean/.gitlibs/libs/jackrusher/mundaneum/84476918ee47b66a2d6128e1a90780e52fd2ae44/deps.edn)
DEPRECATED: Libs must be qualified, change clj-http => clj-http/clj-http (/Users/sean/.gitlibs/libs/jackrusher/mundaneum/84476918ee47b66a2d6128e1a90780e52fd2ae44/deps.edn)
DEPRECATED: Libs must be qualified, change clj-time => clj-time/clj-time (/Users/sean/.gitlibs/libs/jackrusher/mundaneum/84476918ee47b66a2d6128e1a90780e52fd2ae44/deps.edn)
DEPRECATED: Libs must be qualified, change backtick => backtick/backtick (/Users/sean/.gitlibs/libs/jackrusher/mundaneum/84476918ee47b66a2d6128e1a90780e52fd2ae44/deps.edn)
DEPRECATED: Libs must be qualified, change clj-http => clj-http/clj-http (/Users/sean/.gitlibs/libs/jackrusher/mundaneum/84476918ee47b66a2d6128e1a90780e52fd2ae44/deps.edn)
[Rebel readline] Type :repl/help for online help info
user=> (require '[nextjournal.clerk :as clerk])
nil
user=> (clerk/clear-cache!)
:cache-dir/does-not-exist ".cache"
nil
user=> (clerk/serve! {:watch-paths ["notebooks" "src" "index.md"]})
Clerk webserver started on 7777...
Starting new watcher for paths ["notebooks" "src" "index.md"]
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See for further details.
{:watch-paths ["notebooks" "src" "index.md"]}
user=>
sounds like the file watcher lib https://github.com/nextjournal/beholder doesn't work at all for you
It works in a scratch project but doesn't work in clerk-demo
.
And, yes, it's possible that Beholder is problematic. I'm on macOS 10.12 (for reasons). I can try this on Windows/WSL but that means running Google Chrome on WSL which kind of sucks (on macOS, I can run VS Code's Simple Browser and have the browser just as a tab inside my editor).
If I move deps.edn
out of the way in clerk-demo
and start a REPL using the :mvn/version "RELEASE"
it does work, if that helps.
At least, it works for .clj
files. It doesn't seem to eval/render .md
files without an explicit call to show!
(I also tried the :git/sha
version with deps.edn
moved out of the way to ensure it wasn't a conflict with another dependency -- no dice... so the released version 0.3.233 works for me but more recent versions do not)
that's really strange given that beholder didn't change, will dig deeper next week, thanks again for your help
ok, we know what’s going on now (yay open source!): https://github.com/nextjournal/clerk/pull/28
https://github.com/nextjournal/clerk-demo is bumped as well
Confirmed! The demo all works as expected now! Thank you!
index.md
auto-renders for me now, for the first time 🙂
Every file, even the previously-broken introduction.clj
file 🙂
Just to be sure, I ran (clerk/clear-cache!)
in the REPL (which said it deleted the .cache
folder) but it didn't make any difference.
The latest clerk-demo
has :deps {io.github.nextjournal/clerk {:git/sha "7c1842bbe18637afc73c9c82efb044e620e3084f"}