Git Product home page Git Product logo

res_tailwindcss's Issues

Issue with Underscore Arbitrary Modifier in Tailwind CSS

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)

Steps to Reproduce:

  1. Add the above code to a res component. (remove the prefix tw- if not configured)
  2. Ensure Tailwind CSS watcher is running to build the new classes.
  3. Observe the error message during compilation.

Additional Information:

  • Tailwind CSS reference: Tailwind CSS Documentation
  • Other selectors like > are working as expected.
  • Manually modifying the .bs.js output file with the underscore modifier works as expected.
  • It appears the issue might be with the ppx not recognizing this modifier.

Any assistance or guidance on how to resolve this issue would be greatly appreciated. Thank you!

improve the parser

  • more complicated than I thought regarding pseudo-classes, pseudo-elements, attribute-selectors
  • also needs to distinguish to the tailwindcss arbitrary values against attribute-selectors
  • currently, manipulating the string after parsed to get rid of pseudo-*, attribute-selectors 🙅

What to do

  • parse the pseudo-*, attribute-selectors, arbitrary values instead of manipulating string after parsed.

fix to find the project root correctly in OCaml project

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.

Read stanza reference for usage in OCaml project

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)))

issue when continuous space input between class names.

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.

Using command line arg instead of config file

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>"]
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.