Fork me on GitHub
#scittle
<
2022-08-29
>
ray09:08:05

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?

borkdude09:08:40

no idea, do you have a repro?

borkdude09:08:50

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

borkdude09:08:18

is this scittle or nbb?

borkdude09:08:28

(I think I need coffee)

ray09:08:39

it's scittle served via tiny http / nbb

borkdude09:08:08

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

ray09:08:18

(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 ")))))

ray09:08:21

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

ray09:08:43

I'm going to change my profile pic to

ray09:08:11

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

ray09:08:29

after including the missing CSS - shocker - it all works

ray11:08:10

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

ray11:08:21

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

ray11:08:33

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

ray11:08:37

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

ray11:08:10

I know that's how it ends 🙂

borkdude11:08:24

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

ray11:08:11

seems like it's the same

ray11:08:13

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

ray11:08:48

I'm not sure how the site is served though

ray11:08:01

gh pages?

borkdude11:08:08

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

ray12:08:45

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

ray12:08:50

I'll try with that

ray12:08:24

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

ray12:08:49

or I'll just read the file and use send

ray12:08:03

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

ray12:08:47

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

borkdude12:08:10

fair enough

ray12:08:48

at least it's a different reason this time

borkdude12:08:00

facepalm -driven development :)

ray12:08:26

haha - should be my bio on Twitter

ray13:08:58

an hour well spent

borkdude13:08:14

as long as you're getting paid right

ray13:08:51

haha yeah

ray13:08:15

I really should learn to ignore more things

ray13:08:58

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

🎉 2
ray13:08:56

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

🙏 2
ray13:08:45

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

borkdude14:08:59

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

ray14:08:43

I'll check it out, likely tomorrow

ray09:08:19

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

ray09:08:22

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

ray09:08:06

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

borkdude09:08:28

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

borkdude09:08:58

There is an open scittle issue for this

ray09:08:04

yeah that would be nice

ray09:08:53

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

borkdude09:08:29

I'll take care of this tomorrow

ray09:08:30

:thumbsup::skin-tone-3:

ray09:08:52

I can work locally for the time being

ray14:08:41

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

borkdude14:08:15

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

ray14:08:17

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