question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[JIT] prefix as a function breaks some classes

See original GitHub issue

What version of Tailwind CSS are you using? 2.2.15

Reproduction URL https://play.tailwindcss.com/GlwsJggWJP?file=config

Describe your issue When using prefix as a function to apply prefix only on some classes, it seems that classes with one character base name like m-2, p-5, w-full and negative ones like -rotate-6 are not generated.

Add prefix (selector) { return ''; } to tailwind config is breaking the output.

expected

current

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
RobinMalfaitcommented, Oct 19, 2021

Hey! Thank you for your bug report! Much appreciated! 🙏

I’ve been looking into this and wrote a more in-depth explanation here: #5829 What I would recommend you to do is to use the prefix as a string instead of a function.

0reactions
quentinlagachecommented, Oct 19, 2021

Hey @RobinMalfait ! I dug into your explanation and really appreciate how far you push it and all details you provide to explain the issue and how you will sort this in the JIT world. It’s real insights into Tailwind development and a very instructive reading 🙌

In the end, I get a better sense of why prefix as a function is more of a hacky solution in this regard and the lack of consistency it brings to outputted classes.

In my case I will handle it outside of tailwind to keep prefix free tailwind classes.

Thanks for your awesome work 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

JIT does not work when prefix callback is specified · Issue #159
Just to clarify - adding a prefix callback does not break only the should-be-prefixed classes. When I specify the prefix callback, the entire...
Read more >
Just-in-Time Mode - Tailwind CSS
The prefix option cannot detect complete class names when configured as a function. Because we don't generate class names in advance, we can...
Read more >
Some Tailwind styles not working in production with Next.js
Well just so you know, changing it to class means that if there's an element with a class of dark , each child...
Read more >
PHP 8.0: New Functions, Classes and JIT (4/4) | Nette Blog
PHP JIT (Just in Time Compiler)​​ And what is a JIT? JIT can transparently compile PHP directly into machine code, which is executed...
Read more >
Untitled
OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ... <span class="enscript-function-name">JITDisassembler::dump</span>( ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found