2 ms·
If you see this, and you like it: Elm's HTML DSL is similar, and really nice. Every HTML tag (except for `text`) is an implementation of the base function `nod
by eckza 4y ago
If you see this, and you like it: Elm's HTML DSL is similar, and really nice.
Every HTML tag (except for `text`) is an implementation of the base function `node`, which is:
node : String -> List Attr msg -> List Html msg -> Html msg
So in the base library, the `p` tag is implemented as
p : List Attr msg -> List Html msg -> Html msg
p = node "p"
Which means that in Elm, the above content would look like this:
p [] [ text "Hello ", b [] [ text "World" ] ]
i.e., every HTML tag can accept as parameters:
- A list of attributes
- A list of child tags
I've found it to be very elegant to work with; and with a good auto-formatter, it's really easy to build complicated HTML without losing your place and dropping a closing tag.
- djedr 4y agoCertainly! The advantage of a Jevko-based format over the above is that it has the simplicity and elegance parameters (IMO) cranked up to maximum! ;) Now, for the tool support...