Introducing Brackethtml
Consider this variable declaration:
This syntax is called “Brackethtml” it reduces the redundancy of HTML and still can be easily understood as HTML, in addition to supporting HTML normally.
Brackethtml + CSS-in-JS (goober)
Brackethtml already comes with a built-in CSS-in-JS library. In the previous examples, if we wanted to add some style to our button we could do:
Usage rules
The list below describes the usage rules:
The HTML tag name must be followed by square brackets:
The
~
symbol must be used inside tags that may contain children to separate attributes and CSS-in-JS from their children, and must be used between whitespace:
Tag attributes must always come before CSS-in-JS and use only double quotes
"
:
CSS-in-JS must only use single quotes
'
:
Special characters
Some characters should be escaped to be used without Brackethtml interpreting them: ~
, [
, ]
, #
, @
, and $
.
To escape them just wrap them in parentheses (
)
:
Last updated