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

pbs-7.5 doesn't work but pt-7.5 does

Open TobyPerplex opened this issue 8 months ago • 4 comments

I've added @plugin 'tailwindcss-logical'; and have confirmed that the plugin works because pbs-5 works fine. However, pbs-7.5 doesn't work but pt-7.5 does.

TobyPerplex avatar Mar 18 '25 14:03 TobyPerplex

Hi @TobyPerplex, hmmm, that should work, and I have a couple test cases for similar classes like pbs-0.5 that work in v4. I’m currently out of town but I’ll check on this when I’m back in a couple days with that exact class and see what happens. Thanks for letting me know.

stevecochrane avatar Mar 18 '25 15:03 stevecochrane

Yeah no rush. plb-15 also doesn't work, seems like there still is a set list of spacing you can use. Weird, thought I read somewhere that in tailwind4 you can use any value. Hmmmm.

TobyPerplex avatar Mar 18 '25 15:03 TobyPerplex

I just gave this a try and I can confirm that anything that wasn't on the Tailwind v3 default scale isn't being generated with this plugin for v4. I think this is because this is using what is now called the "legacy JavaScript-based plugin" API, which works largely the same as it did with v3 for backward compatibility reasons and doesn't support everything in v4.

I don't have a good answer for you yet as updating this plugin to the newer API seems like a large undertaking, but here are some possible solutions that work right now:

  1. You could use a JavaScript config file (tailwind.config.js), add the values you need to the theme as in v3, and load it with the @config directive.
  2. You could use custom values for anything not on the default scale. This could be any value including the measurement unit, such as pbs-[7.5rem].
  3. You could also use a custom property value, such as pbs-(--spacing-7.5) or anything else you like. You would need to create a new variable each time, such as --spacing-7.5: calc(var(--spacing) * 7.5);.

stevecochrane avatar Mar 20 '25 03:03 stevecochrane

Ah so thats the problem, thanks for finding this out! All great workarounds for now. If you don't have the time updating this plugin to the newer API I'll try and find some time to do a pull request.

TobyPerplex avatar Mar 20 '25 08:03 TobyPerplex