Fork me on GitHub
#nbb
<
2021-08-14
>
Chris McCormick12:08:55

@borkdude what is great about nbb is that it is lightweight and fast to get it up and running. One can just npm i nbb and start. Does there exist yet anything like Wisp but using bb/sci? https://wisp-lang.github.io/wisp/ I mean so that you could do something like this:

<script src="bb.min.js"></script>

<script type="application/cljs">
(js/alert "Hello world!")
</script>

<!-- Load from a file: -->
<script type="application/cljs" src="my-script.cljs"></script>
The code that Wisp uses to find all <script> tags and run their code is here: https://github.com/wisp-lang/wisp/blob/master/src/engine/browser.wisp#L35 All npm projects have their artifacts automatically available via CDNs so that would mean people could create a simple index.html file, load bb.min.js from CDN, and then put inline cljs code in there.

Chris McCormick12:08:14

Awesome. I will have to experiment with using this in Slingcode! Thanks!

borkdude12:08:48

@chris358 OK, please let me know if you run into issues, don't hesitate to report them

Chris McCormick12:08:33

Live reload on save works too. \o/

borkdude13:08:31

I now added an initial version of cljs.pprint to nbb. It's lazily loaded

borkdude14:08:26

$ nbb -e "(require '[cljs.pprint]) (cljs.pprint/pprint {:a {:b {:c {:d {:e (range 20)}}}}})"
{:a
 {:b
  {:c {:d {:e (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19)}}}}}