Closed dillonkearns closed 3 years ago
There's some difficulty in the translation of pseudo-classes in this tool.
Usually, you'd want to group pseudo selectors. So
Turn this
<div class="bg-gray-100 hover:bg-gray-900 hover:border-gray-800">
Into this
div
[ css
[ Css.hover
[ Tw.border_gray_800
, Tw.bg_gray_900
]
, Tw.bg_gray_100
]
]
[]
You need to handle breakpoints and pseudo classes at the same time
So, turn this:
<div class="bg-gray-100 lg:bg-white lg:hover:bg-gray-100">
Into this:
div
[ css
[ Bp.lg
[ Css.hover [ Tw.bg_gray_100 ]
, Tw.bg_white
]
, Tw.bg_gray_100
]
]
[]
Ah yes, good point I hadn't considered 2. I'm actually handling the grouping (1) already by grouping things in a Dict.
So I'll just need to handle pseudo classes as well as pseudo classes nested under breakpoints now 👍
This is now working, including nested pseudoclasses under breakpoints 🙌 🎉
I believe
elm-tailwind-modules
useselm-css
functions for the pseudo classes listed here: https://github.com/matheus23/elm-tailwind-modules/blob/cd5809505934ff72c9b54fd1e181f67b53af8186/src/helpers.ts#L11-L14.Right now, anything that looks like a breakpoint, like
lg:px-2
, is turned into a breakpoint helper.Example:
It currently turns this HTML
Into this Elm:
But it should instead generate: