green-labs / res_tailwindcss Goto Github PK
View Code? Open in Web Editor NEWReScript PPX which validates the tailwindcss class names
License: MIT License
ReScript PPX which validates the tailwindcss class names
License: MIT License
Class of string option -> Class of string list
Align to the changes of ReScript compiler V10
I'm encountering an issue when trying to use the underscore arbitrary modifier to style the descending a of a div. Below is the code I'm using:
<div
className={cx([
%twc(
"tw-overflow-hidden tw-transition-[padding-top] tw-ease-out tw-duration-[400ms] [&_a]:tw-mt-4"
),
switch state {
| true => %twc("tw-p-20")
| false => %twc("tw-max-h-0")
},
])}
However, it results in the following error:
104 ┆ className={cx([
105 ┆ %twc(
106 ┆ "tw-overflow-hidden tw-transition-[padding-top] tw-ease-out tw-dur
┆ ation-[400ms] [&_a]:tw-mt-4"
107 ┆ ),
Class name not found: [&_a]:tw-mt-4
FAILED: cannot make progress due to previous errors.
>>>> Finish compiling(exit: 1)
tw-
if not configured)Any assistance or guidance on how to resolve this issue would be greatly appreciated. Thank you!
pseudo-classes
, pseudo-elements
, attribute-selectors
arbitrary values
against attribute-selectors
pseudo-*
, attribute-selectors
🙅What to do
pseudo-*
, attribute-selectors
, arbitrary values
instead of manipulating string after parsed.Currently, find_project_root
func is working to find the project root with the location of bsconfig.json
. It doesn't make sense in the OCaml project. It should be fixed to find *.opam
, dune-project
, or dune-workspace
instead.
Regarding the usage in the OCaml project. It needs to know where the tailwind CSS file is. (In the ReScript project, the path of the tailwind CSS file is passed in command line args.)
In the OCaml project, the best way is getting the path from dune
file as inline_tests
ppx does such as below.
(library
(res_tailwindcss
(deps
"src/styles/tailwind.css"))
(name example)
(public_name example)
(libraries core str)
(preprocess
(pps res_tailwindcss)))
Are there plans to implement automatic sorting of classes, based on the convention followed by tw’s own prettier plugin?
*.mli needed
ex
%twc("fixed w-full")
If there are two spaces between the class names, an error occurs that the class cannot be found.
It's an issue caused by a typo, but if you look at the error message, the user will try to find the problem in the wrong build of the tailwind.
Having a command line arg to get a tailwind CSS file path instead of making the redundant config file.
// bsconfig.json
"ppx-flags": [
...,
["@greenlabs/ppx-tailwindcss/ppx", "--path <path_to_tailwindcss>"]
]
Remove the dependency to ppxlib
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.