Fork me on GitHub
#scittle
<
2023-07-24
>
didibus01:07:27

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

didibus01:07:18

<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?

borkdude08:07:23

No errors in the console?

borkdude08:07:50

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

didibus14:07:49

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

borkdude14:07:29

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

didibus14:07:36

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.

didibus14:07:17

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

didibus14:07:34

I tried a plain js script and that worked.

borkdude14:07:34

not sure, but I don't think scittle cares

didibus14:07:28

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.

didibus14:07:40

Anyways, I'll try to create a repro

borkdude14:07:13

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

borkdude14:07:55

try it like this:

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

borkdude14:07:14

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

didibus14:07:46

That's what I have

borkdude14:07:45

no, your example above contains more whitespace

borkdude14:07:29

I'm almost positive that this is the issue

borkdude14:07:59

try:

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

didibus14:07:11

Oh, really? Okay will try.

didibus16:07:49

It worked!

didibus16:07:09

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

borkdude17:07:30

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

borkdude18:07:13

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

didibus18:07:28

Oh sorry 😞

borkdude18:07:00

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

borkdude18:07:13

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

2