kotlinx.html
kotlinx.html copied to clipboard
Add CSS DSL Support
We could add support for CSS DSL. Currently there is only one way to write CSS and that's to use hard coded raw strings which very quickly increase the chances of errors.
It would be used something like this.
Inline Style:
div {
inlineStyle {
property("margin", "4px")
property("padding", "8px")
}
}
Internal style (in header part):
head {
style {
rule("div") {
property("margin", "4px")
property("padding", "8px")
}
rule(".dropdown") {
property("margin", "4px")
property("padding", "8px")
}
}
}
May be with some brain storming we can add selection DSL also.
Please provide your feedback and ideas.
I guess this totally makes sence in case of statically-typed DSL. Before you that - string or small local function for converting map to style string is fine, as for me.
Wouldn't this just duplicate what kotlinx-css library does?
Wouldn't this just duplicate what kotlinx-css library does?
What? There is a kotlix-css library? Can you please give me a link to it?
https://github.com/JetBrains/kotlin-wrappers/tree/master/kotlin-css
I came across this issue while searching for a similar thing, but I specifically need inline CSS, since I'm using this library to compose HTML emails, and the best practice is to avoid
I don't know if it's more appropriate to request an inline style DSL for this library or for that one, but it would be really nice to have an ergonomic solution to building inline styles with a type-safe DSL.