Skip to content

@apply doesn't work with @layer base and @layer components anymore in v4 #17082

Answered by wongjn
nemanjam asked this question in Help
Discussion options

You must be logged in to vote

How to name that utility, does that name e.g. tags-utility affect anything and where is it used?

The must match of of these two regular expressions:

const IS_VALID_STATIC_UTILITY_NAME = /^-?[a-z][a-zA-Z0-9/%._-]*$/
const IS_VALID_FUNCTIONAL_UTILITY_NAME = /^-?[a-z][a-zA-Z0-9/%._-]*-\*$/

The name is the class name that you'd use.

How to use defined class with @apply, I can still just use <h1 class="b-h1">text</h1> as before? No namespace with tags-utility?

I'm not sure where this "namespace" concept has come from, but for b-h1, you'd do:

@utility b-h1 {
  @layer base {
    @apply text-3xl…

Replies: 4 comments 8 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@wongjn
Comment options

wongjn Mar 9, 2025
Collaborator

Answer selected by nemanjam
Comment options

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

@wongjn
Comment options

wongjn Mar 9, 2025
Collaborator

@nemanjam
Comment options

@wongjn
Comment options

wongjn Mar 9, 2025
Collaborator

@nemanjam
Comment options

Comment options

You must be logged in to vote
1 reply
@wongjn
Comment options

wongjn Apr 30, 2025
Collaborator

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