How to register 'tw' and 'setup' globally ?? #82
-
Excuse me , How to register 'tw' and 'setup' globally ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Hey 👋 one important things to note here is that If you don't want to even have to import
|
Beta Was this translation helpful? Give feedback.
-
Hey hey! I'd like to just jump in here too since I am also a Nuxt user who's aspiring to become a Twind user. I've thrown together a quick demo of one way you could go about using Twind anywhere in your Nuxt app. https://codesandbox.io/s/nuxtjs-twind-s90bw The approach is to create a <template>
<h1 :class="tw('text-4xl')">
Hello
</h1>
</template> If it's of any use, please let me know. |
Beta Was this translation helpful? Give feedback.
Hey hey! I'd like to just jump in here too since I am also a Nuxt user who's aspiring to become a Twind user. I've thrown together a quick demo of one way you could go about using Twind anywhere in your Nuxt app.
https://codesandbox.io/s/nuxtjs-twind-s90bw
The approach is to create a
tw
instance in a plugin (~/plugins/twind.js
) and it's here you can include your config. You then inject that instance into your Nuxt app for use virtually anywhere. I've elected to simply use a computed property so I could style directly in my template.If it's of any use, please let me know.