scittle

2023-07-24T01:45:27.160069Z

For some reason when I try to load from a source file it doesn't work. It seems my browser doesn't load it

2023-07-24T01:46:18.261219Z

<script src="cljs/script.cljs"
                type="application/x-scittle">
        </script>
In the browser dev tools, it doesn't show up. I'm wondering if there is some kind of security for script tags of custom type?

borkdude 2023-07-24T08:50:23.610289Z

No errors in the console?

borkdude 2023-07-24T08:50:50.686379Z

How are you hosting the HTML file, in a server?

2023-07-24T14:30:49.455889Z

Babashka http-server, just serving the public directory from my local

borkdude 2023-07-24T14:31:15.788879Z

seems good

borkdude 2023-07-24T14:31:29.903959Z

if you can make a repro project I can run locally, I could try

2023-07-24T14:32:36.558129Z

I'll try too sometime this week. Thanks! I was wondering if mime type mattered. Babashka http-server doesn't have .cljs file extension going to application/x-scittle for example.

2023-07-24T14:33:17.393009Z

And I was using Microsoft Edge, didn't try in other browsers.

2023-07-24T14:33:34.434549Z

I tried a plain js script and that worked.

borkdude 2023-07-24T14:33:34.592869Z

not sure, but I don't think scittle cares

2023-07-24T14:34:28.711979Z

The weird thing is, in the dev tools for Edge, you can see the loaded resources, the JS script appears, but not the cljs one. So it's like the browser refuses to load it.

2023-07-24T14:34:40.508499Z

Anyways, I'll try to create a repro

borkdude 2023-07-24T14:34:57.053219Z

thanks

borkdude 2023-07-24T14:35:27.636989Z

here is the code for loading the script tags, it's really small https://github.com/babashka/scittle/blob/381f3d82343dbfeaf4d0e26a5d9dd54101ac940e/src/scittle/core.cljs#L66-L87

borkdude 2023-07-24T14:36:13.479739Z

perhaps the issue is that your script tag has text content?

borkdude 2023-07-24T14:36:55.696159Z

try it like this:

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

borkdude 2023-07-24T14:37:14.683389Z

I think the code could be made more robust, prioritizing the src thing and then the code if there is no src thing

2023-07-24T14:40:46.126829Z

That's what I have

borkdude 2023-07-24T14:41:45.543629Z

no, your example above contains more whitespace

borkdude 2023-07-24T14:42:29.615519Z

I'm almost positive that this is the issue

borkdude 2023-07-24T14:42:59.809879Z

try:

<script src="cljs/script.cljs" type="application/x-scittle"></script>
exactly like this not over multiple lines

2023-07-24T14:47:11.733399Z

Oh, really? Okay will try.

2023-07-24T16:55:49.372569Z

It worked!

2023-07-24T16:56:09.242889Z

So me formatting the script tag on multiple line is what was breaking it.

borkdude 2023-07-24T17:21:30.854069Z

feel free to file an issue, I'll fix it right away

borkdude 2023-07-24T18:25:13.192529Z

Lol, I just created 68 but I'll close that one, thanks :)

2023-07-24T18:25:28.596999Z

Oh sorry 😞

borkdude 2023-07-24T18:27:00.469109Z

no, it was just funny, no need to be sorry, it was literally almost at the same time :)

borkdude 2023-07-24T18:27:13.737959Z

I think this fixes it but I have to test it tomorrow before I merge: https://github.com/babashka/scittle/pull/70

🤘 1