Kotlin / kotlinx.html

Kotlin DSL for HTML
Apache License 2.0
1.63k stars 133 forks source link

ScriptType of `<script>` is missing type "module" #197

Open johannesrave opened 2 years ago

johannesrave commented 2 years ago

I couldn't find a way to express

<script type="module" src="/scripts/.js"></script>

other than

unsafe {
    raw("<script type="module" src="/scripts/live-reload.js"></script>")
}

Is that missing from ScriptType on purpose for some reason? Or has it not yet been implemented?

JohannesOehm commented 1 year ago

You could either do:

script(src = "index.js") {
    attributes["type"] = "module"
}

or

script(src = "index.js", type = "module") { }