Closed dylanirlbeck closed 4 years ago
Nice addition! :)
From my understanding, all classnames are being wrapped in [%tw "..."]
. That's probably too aggressive, what about other classnames (not from tailwind)? Let's say that one has created a classname .custom_classname
and uses it alongside tailwind classnames:
<div className="custom_classname flex flex-col items-center" />
It gets transformed to:
className=[%tw "custom_classname flex flex-col items-center"]>
Which is wrong and will produce an error since the ppx
will then detect that custom_classname
is not a valid tailwind class.
Since we are already able to extract class names from the tailwindcss file, I think we should only transform these classes. So the example above should become something similar to:
className={"custom_classname " ++ [%tw "flex flex-col items-center"]}>
I have updated your lock dirs and formatted the code. Please @dylanirlbeck pull the last commit before pushing any more changes.
Fixes #81
This script would transform every existing instance (in a
.re
file) ofclassName="..."
intoclassName=[%tw "..."]
by calling./node_modules/@dylanirlbeck/tailwind-ppx/use_ppx.exe
.I should making the path to the script easier to execute, but this might not be necessary.
TODO
bsconfig.json
(with a note that script could wrongly execute ifbsconfig
is found earlier than project root)--files **/glob
~ (just doing all.re
files)