Skip to content

Function that transforms tw string to CSS rules object? #13768

Answered by wongjn
piscopancer asked this question in Help
Discussion options

You must be logged in to vote

You could use @apply as you would in CSS:

plugins: [
  plugin(({ addUtilities }) => {
    addUtilities({
      '.fancy': {
         '@apply bg-red-100 text-red-500 font-semibold': {},
      },
    })
  }),
],

Though Adam Wathan, the creator of Tailwind, does not recommend this: #11012 (reply in thread).

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by piscopancer
Comment options

You must be logged in to vote
0 replies
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