This is how I like to use webjars in kotlin.
build.gradle.kts dependencies:
dependencies {
// webjars
implementation("org.webjars:webjars-locator:0.46")
implementation("org.webjars.npm:htmx.org:1.9.2")
}
endpoint:
val htmx = textFromWebJar("htmx.js")
routing {
get("/asset/htmx.js") { call.respondText(htmx, ContentType.Application.JavaScript) }
}