I propose to add an alternative to JS-in-CSS when building plugins. #11012
NnicanBuak
started this conversation in
Ideas
Replies: 2 comments 15 replies
-
You can actually do this already with const plugin = require('tailwindcss/plugin')
module.exports = {
plugins: [
plugin(function({ addComponents }) {
addComponents({
'.button': {
'@apply p-1 rounded-xl font-[600]': {},
},
'.button-primary': {
'@apply bg-primary text-white hover:bg-secondary': {},
dataPonterType: 'highlight'
},
})
})
]
} |
Beta Was this translation helpful? Give feedback.
15 replies
-
Although, the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
What if there was an alternative to using the not-so-friendly JS-in-CSS syntax versus Utility Tailwindcss classes? It would make it very easy to create custom components and base styles inside Tailwindcss.
What it looks like now:
What it might look like with the new
tailwind()
plugin feature (this function does not exclude the existence oftheme()
):The main improvement this feature brings is the unification of the syntax approach in the application and in the Tailwind config.
This feature is especially useful when you want to write not just styles, but styles referencing the theme(), as in the example.
Beta Was this translation helpful? Give feedback.
All reactions