For some reason when I try to load from a source file it doesn't work. It seems my browser doesn't load it
<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?No errors in the console?
How are you hosting the HTML file, in a server?
Babashka http-server, just serving the public directory from my local
seems good
if you can make a repro project I can run locally, I could try
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.
And I was using Microsoft Edge, didn't try in other browsers.
I tried a plain js script and that worked.
not sure, but I don't think scittle cares
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.
Anyways, I'll try to create a repro
thanks
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
perhaps the issue is that your script tag has text content?
try it like this:
<script src="cljs/script.cljs" type="application/x-scittle"></script>I think the code could be made more robust, prioritizing the src thing and then the code if there is no src thing
That's what I have
no, your example above contains more whitespace
I'm almost positive that this is the issue
try:
<script src="cljs/script.cljs" type="application/x-scittle"></script>
exactly like this not over multiple linesOh, really? Okay will try.
It worked!
So me formatting the script tag on multiple line is what was breaking it.
feel free to file an issue, I'll fix it right away
Lol, I just created 68 but I'll close that one, thanks :)
Oh sorry 😞
no, it was just funny, no need to be sorry, it was literally almost at the same time :)
I think this fixes it but I have to test it tomorrow before I merge: https://github.com/babashka/scittle/pull/70