Skip to content

[v4] Use of @theme and @theme inline #17826

Answered by adamwathan
severinlandolt asked this question in Help
Discussion options

You must be logged in to vote

Hey! The main difference is in the output of utilities that are derived from the theme values. If you use inline, the actual value of the theme variable is inlined into the utility, instead of referencing a variable:

/* Input */
@import "tailwindcss";

@theme {
  --color-potato: #d2a062;
}

/* Output */
:root, :host {
  --color-potato: #d2a062;
}

.bg-potato {
  background-color: var(--color-potato);
}

Here's the same thing with inline:

/* Input */
@import "tailwindcss";

@theme inline {
  --color-potato: #d2a062;
}

/* Output */
:root, :host {
  --color-potato: #d2a062;
}

.bg-potato {
  background-color: #d2a062;
}

You can always use inline if you want but in my mind it's more idiomatic…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by severinlandolt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants