build: prepare to serve next-ui dist

This commit is contained in:
Gauthier Roebroeck 2025-10-15 16:10:00 +08:00
parent 75393bb3e3
commit c78b47c162
2 changed files with 14 additions and 1 deletions

View file

@ -143,6 +143,7 @@ kotlin {
}
val webui = "$rootDir/komga-webui"
val nextui = "$rootDir/next-ui"
tasks {
withType<JavaCompile> {
sourceCompatibility = "17"
@ -218,6 +219,18 @@ tasks {
}
}
// modifies index.html to inject ThymeLeaf th: tags
register<Copy>("prepareThymeLeafNext") {
group = "web"
from("$nextui/dist/index.html")
into("$projectDir/src/main/resources/public/")
filter { line ->
line.replace("((?:src|content|href)=\")([\\w]*/.*?)(\")".toRegex()) {
it.groups[0]?.value + " th:" + it.groups[1]?.value + "@{" + it.groups[2]?.value?.prefixIfNot("/") + "}" + it.groups[3]?.value
}
}
}
withType<ProcessResources> {
filesMatching("application*.yml") {
expand(project.properties)

View file

@ -39,7 +39,7 @@ class WebMvcConfiguration : WebMvcConfigurer {
).addResourceLocations("classpath:public/")
.setCacheControl(CacheControl.noStore())
listOf("css", "fonts", "img", "js")
listOf("css", "fonts", "img", "js", "assets")
.forEach {
registry
.addResourceHandler("/$it/**")