Tool to generate CSS classes, a bit like tailwind but less strict.
If you have Go installed, you can install styler with:
go install github.com/devOpifex/styler@latest
Otherwise, you can download the binary from the releases page.
Create a .styler
file in your project root.
styler -create
First, edit .styler
config file, then add a class
attribute to your HTML elements.
ui <- fluidPage(
div(
class = "display-flex padding-2 margin-bottom-2 width-40",
div(
class = "flex-grow-1",
h1("Hello, world!", class = "color-red-400 hover:color-cyan-500")
),
div(
class = "flex-shrink-1 md@display-none",
h2("This is hidden on medium and larger screens", class = "color-blue hover:color-green")
)
)
)
Call styler
to generate the CSS.
styler
- Media queries are suffixed with
@
e.g.:md@
,lg@
- States are suffixed with
:
, e.g.:hover:
,active:
- Numeric values are set as
unit
specified in the config (defaults torem
) and are divided by thedivider
specified in the config (defaults to4
), e.g.:padding-top-2
will result inpadding-top: 0.5rem
- Numerics precded by
~
are treated as strict and are not divided or suffixed withunit
e.g.:flex~1
results inflex: 1
- Media queries can be edited in
.styler
config file - Colors can be edited in
.styler
config file - Extracted CSS properties are checked against the W3C CSS Properties table