Gunslingor
03/30/2020, 6:33 AMspierce7
03/30/2020, 5:37 PMGunslingor
03/30/2020, 5:39 PMspierce7
03/30/2020, 5:39 PMGunslingor
03/30/2020, 5:39 PMspierce7
03/30/2020, 5:39 PMGunslingor
03/30/2020, 5:40 PMspierce7
03/30/2020, 5:42 PMid
or style
), and they are accessible via function parameters instead as part of the DSLdiv(id = "divId") {
}
if you want to add a custom attribute you can do that via
div("customAttribute" to "customValue") {
}
Gunslingor
03/30/2020, 5:46 PM// If you are using Ktor, you can use this as well
implementation("dev.scottpierce.kotlin-html:kotlin-html-ktor:0.7.23")
What is that package? I currently got these but haven't made the css stuff work right yet:
implementation("io.ktor:ktor-html-builder:$ktorVersion")
implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:$kotlinxHtmlVersion")
implementation("org.jetbrains:kotlin-css-jvm:1.0.0-pre.93-kotlin-$kotlinVersion")
val styles = CSSBuilder().apply {
body {
margin = "0px"
padding = "0px"
backgroundColor = Color.bisque
}
}
val stylesString = styles.toString()
println(styles.toString())
style {
unsafe {
raw(stylesString)
}
}
spierce7
03/30/2020, 6:36 PM"dev.scottpierce.kotlin-html:kotlin-html-writer:0.7.23"
and if you want to use ktor you’d use
"dev.scottpierce.kotlin-html:kotlin-html-ktor:0.7.23"
StringHtmlOutput().html {
body(
style = {
margin(0.px)
padding(0.px)
backgroundColor(Color(0, 0, 0))
}
) {
}
}
routing {
get {
call.respondHtml {
head {
}
body {
}
}
}
}