Introduction to Template2 DSL
mainZIO HTTP Template2 is a type-safe HTML templating DSL for Scala. It allows you to write HTML, CSS, and JavaScript directly in Scala code with compile-time checking. It is designed for composability (building components as Scala functions) and eliminates the need for separate template files.
import zio.http.template2._
val page: Dom =
html(
head(title("Hello World")),
body(
h1("Hello, ZIO HTTP Template2!"),
p("This is my first template.")
)
)