Fork me on GitHub
#nbb
<
2023-11-21
>
athomasoriginal01:11:35

I’m running into an issue calling nbb from another JS program. I use eleventy and eleventy lets you specify your own templating engine. My goal is to have the hiccup in the .cljs files be processed by nbb. You can see my https://github.com/athomasoriginal/eleventy-test-cljs. The idea is, whenever a local .cljs file changes, we: • https://github.com/athomasoriginal/eleventy-test-cljs/blob/main/.eleventy.js#L21 • nbb runs https://github.com/athomasoriginal/eleventy-test-cljs/blob/main/run_clj.cljs and run_clj.cljs loads the sample template file (https://github.com/athomasoriginal/eleventy-test-cljs/blob/main/src/test.cljs) which depends on .https://github.com/athomasoriginal/eleventy-test-cljs/blob/main/src/extra/components.cljs when I run eleventy, I can modify test.cljs and it live updates. However, if I modify a components.cljs , the nbb script re-runs, but doesn’t seem to fetch the latest in components.cljs Is there something in the way resolving local ns’s works that might cause this? think_beret

athomasoriginal01:11:50

The reason I think the issue may be with nbb is because if I slurp the components.cljs I get the latest code. e.g.

(comment
  (p/let [components-res (nbb/slurp "./src/extra/components.cljs")]
    (-> (nbb/load-string components-res)
        (.then (fn [result]
                 (js/console.log "SLURP TEST 1: " (rds/render-to-static-markup [(last-form result)]))
                 (js/console.log "SLURP TEST 2: " (rds/rende-to-static-markup [(last-form result)])))))))  
The above will pickup the latest code changes when eleventy re-runs the nbb script.

athomasoriginal02:11:29

Is it an async issue when requiring a local dep? :thinking_face:

borkdude08:11:54

Sorry I didn’t respond, I missed it. I’ll look into it later today

borkdude10:11:11

yes, namespace are loaded asynchronously

borkdude10:11:42

you could also use require + :reload possibly