Serve hashed static resources

This commit is contained in:
Paul-Henri Froidmont 2025-12-23 23:06:16 +01:00
parent 3278ddbd1c
commit 5381487d4f
Signed by: phfroidmont
GPG key ID: BE948AFD7E7873BE
8 changed files with 141 additions and 14 deletions

View file

@ -60,15 +60,6 @@ object example extends ScalaCommon:
def moduleDeps = Seq(scalive.zio)
def mvnDeps = Seq(mvn"dev.optics::monocle-core:3.1.0", mvn"dev.zio::zio-logging:2.5.1")
def scaliveBundle = Task {
os.copy(
from = example.js.bundle().path,
to = Task.dest / "public" / "app.js",
createFolders = true
)
PathRef(Task.dest)
}
def tailwindConfig = Task.Source(moduleDir / "tailwind.css")
def generateCss = Task {
@ -81,17 +72,22 @@ object example extends ScalaCommon:
).call().out.text()
}
def cssResources = Task {
def customResources = Task {
os.write(
target = Task.dest / "public" / "app.css",
data = generateCss(),
createFolders = true
)
os.copy(
from = example.js.bundle().path,
to = Task.dest / "public" / "app.js",
createFolders = true
)
PathRef(Task.dest)
}
def resources = Task {
super.resources() :+ scaliveBundle() :+ cssResources()
super.resources() :+ customResources()
}
object js extends TypeScriptModule: