scittle 2022-08-29

trying to get scittle working with tinyhttp via nbb and it's going well, except one strange thing with css... any ideas why the nbb version does not render the grid in the same way?

no idea, do you have a repro?

(I haven't tested anything with css in nbb)

is this scittle or nbb?

(I think I need coffee)

it's scittle served via tiny http / nbb

maybe you need to include the css that is embedded in that page

(ns interactive.server.web
  (:require ["@tinyhttp/app" :as app]
            ["path" :as path]))


(def app (app/App.))


(defn -main
  [_]
  (-> app
      (.get "/" (fn [_req res]
                  (.sendFile res (path/resolve "public/index.html"))))
      (.get "/cljs/:ns" (fn [req res]
                          (.sendFile res (path/resolve (str "public" (.-path req))))))
      (.listen 3000 (fn [] (js/console.log "Listening on ")))))

oh shit yeah ... I didn't see the css/style.css at the top of the file facepalm

I'm going to change my profile pic to

enjoy your coffee. I'm gonna get one too 🙂

after including the missing CSS - shocker - it all works

the CLJS delivered by scittle is interpreted by I get a message saying that I have an XML syntax error

I have tried setting the content type but it's not having the desired effect

(.set res #js {"Content-Type" "application/x-scittle"})

The same error does not come from the babashka example. What content type are you setting there?

I know that's how it ends 🙂

> What content type are you setting there? Have you looked?

seems like it's the same

<script type="application/x-scittle" src="cljs/tictactoe.cljs"></script>

I'm not sure how the site is served though

yes, scittle visits every script tag with application/x-scittle and fetches the CLJS

ok, when I look at the type served it's set to octet-stream

I'll try with that

seems like sendFile does some magic so I'll have to check further on how to control that

or I'll just read the file and use send

anyway ... I'll get back with the answer

setting it to text/plain removes the noise but is obviously a lie. I hate computers again.

fair enough

at least it's a different reason this time

facepalm -driven development :)

haha - should be my bio on Twitter

an hour well spent

as long as you're getting paid right

I really should learn to ignore more things

anyway - getting this all set up will be very handy for a state / data generation tool I am making for the FC UI devs

🎉 1

I'll see if we can get a blog post out of it

🙏 1

@borkdude is there some guidance on how I can add promesa as requested in https://github.com/babashka/scittle/issues/28

how did I test it? It works on my project to do fetch 😉

wasn't too hard to work it out from 1st principles

the elegance of splitting the code up into these modules is really nice

There is a similar config for pprint in nbb: https://github.com/babashka/nbb/blob/main/src/nbb/pprint.cljs We should move it to sci.configs and then we can also use it in scittle

There is an open scittle issue for this

yeah that would be nice

thanks for merging the PR. Is the publication to the CDN underway?

I'll take care of this tomorrow

I can work locally for the time being

Yes, this should be relatively easy. There is a project called sci.configs. nbb itself uses this to add promesa to the SCI config. you can do the same for scittle

I'll check it out, likely tomorrow

where should I make a PR with an example of nbb serving scittle?

is this repo public already? we could link to it maybe?

I was thinking of making a minimal example but ok, I can do that with a toy repo and make it public for linking.