Skip to content

Background image with tailwind #11515

Answered by wongjn
ShaungBhone asked this question in Help
Jun 30, 2023 · 1 comments · 6 replies
Discussion options

You must be logged in to vote

As per the documentation:

The most important implication of how Tailwind extracts class names is that it will only find classes that exist as complete unbroken strings in your source files.

If you use string interpolation or concatenate partial class names together, Tailwind will not find them and therefore will not generate the corresponding CSS:

Don’t construct class names dynamically

<div class="text-{{ error ? 'red' : 'green' }}-600"></div>

In the example above, the strings text-red-600 and text-green-600 do not exist, so Tailwind will not generate those classes.
Instead, make sure any class names you’re using exist in full:

Always use complete class names

<div class="{{ error ? 'tex…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@abr4xas
Comment options

@wongjn
Comment options

@abr4xas
Comment options

@wongjn
Comment options

@abr4xas
Comment options

Answer selected by ShaungBhone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants