Let's create a printCss function that works the same way as respondCss, only instead of sending the obtained css to the user, it will output it to the console:
fun printCss(builder: CssBuilder.() -> Unit) {
println(CssBuilder().apply(builder).toString())
}
Let's check how it works.
printCss {
rule(".Header") {
color = Color("#00FF00")
fontSize = LinearDimension("30px")
fontStyle = FontStyle("italic")
}
rule("#Header2") {
margin = "30px"
textDecoration = TextDecoration(setOf(TextDecorationLine.underline))
}
}
What will be output to the console when this code runs?
Open the IDE and check the result yourself.