tailwindcss-classnames icon indicating copy to clipboard operation
tailwindcss-classnames copied to clipboard

Build is missing negative value classnames

Open ryangoree opened this issue 3 years ago • 2 comments

Environment:

  • TailwindCSS version: 3.0.7
  • tailwindcss-classnames version: 3.0.0
  • Node.js version: 16.13.1

Current Behavior

After using the CLI, the build is missing classes prefixed with - (e.g. -mt-8) for negative values.

Expected Behavior

Build should include classes prefixed with -.

How to Reproduce

  1. Install tailwindcss-classnames@latest
  2. Run npx tailwindcss init
  3. Add "generate-css-types": "tailwindcss-classnames" to your package.json scripts.
  4. npm run generate-css-types
  5. Search the resulting tailwindcss-classnames.ts file for '- and find 0 results.

Possible solutions (Optional)

Additional Questions

  • [x] I've searched the issues list and this is not a duplicate
  • [ ] I'm willing to fix this error

ryangoree avatar Dec 19 '21 08:12 ryangoree

Hi I am new to tailwindcss-classnames. I meet the same problem.

Here is my solution.

Starting with typescript 4.1

We can define a type that would validate the string without actually defining all the options.

stackoverflow

image

image

cqh963852 avatar May 05 '22 13:05 cqh963852

Hi I am new to tailwindcss-classnames. I meet the same problem.

Here is my solution.

Starting with typescript 4.1

We can define a type that would validate the string without actually defining all the options.

stackoverflow

image

image

but after the generate-css-types via tailwindcss-classnames, your new type with a negative value will be removed

BogdanovBogdan avatar Jun 29 '23 03:06 BogdanovBogdan