diff --git a/core/src/scalive/Scalive.scala b/core/src/scalive/Scalive.scala index b6ed40b..0566d9d 100644 --- a/core/src/scalive/Scalive.scala +++ b/core/src/scalive/Scalive.scala @@ -26,6 +26,7 @@ package object scalive extends HtmlTags with HtmlAttrs with ComplexHtmlKeys: private[scalive] lazy val linkState = dataPhxAttr("link-state") lazy val click = phxAttrJson("click") def value(key: String) = phxAttr(s"value-$key") + lazy val trackStatic = htmlAttr("phx-track-static", BooleanAsAttrPresenceCodec) implicit def stringToMod(v: String): Mod = Mod.Content.Text(v) implicit def htmlElementToMod(el: HtmlElement): Mod = Mod.Content.Tag(el) diff --git a/example/src/RootLayout.scala b/example/src/RootLayout.scala index 9d8eb66..9fef2ef 100644 --- a/example/src/RootLayout.scala +++ b/example/src/RootLayout.scala @@ -7,8 +7,13 @@ object RootLayout: headTag( metaTag(charset := "utf-8"), metaTag(nameAttr := "viewport", contentAttr := "width=device-width, initial-scale=1"), - scriptTag(defer := true, typ := "text/javascript", src := "/static/app.js"), - linkTag(rel := "stylesheet", href := "/static/app.css"), + scriptTag( + defer := true, + phx.trackStatic := true, + typ := "text/javascript", + src := "/static/app.js" + ), + linkTag(phx.trackStatic := true, rel := "stylesheet", href := "/static/app.css"), titleTag("Scalive Example") ), bodyTag(