question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to use vue-tailwind in nuxt generated app

See original GitHub issue

In my nuxt.js project I am using the datepicker. I import the library as a plugin in this way:

/plugins/vue-tailwind.js

import Vue from 'vue'
import VueTailwind from 'vue-tailwind'
Vue.use(VueTailwind)

/nuxt.config.js

plugins: ['~plugins/vue-tailwind']

and the component works perfectly in development.

My problem is that the component is not rendered when I serve the app generated with

nuxt generate

I already tried to load the plugin this way:

{ src: '~plugins/vue-tailwind', mode:  'client' }

and also tried to put the component between client-only tag

<client-only>
            <t-datepicker
              v-model="date"
              :max-date="today"
              placeholder="Select a date"
              date-format="Y-m-d"
              user-format="d-M-Y"
            />
</client-only>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
alfonsobriescommented, Jan 20, 2021

ok think that maybe the documentation is not clear think I’m gonna revisit it, meanwhile since version 2 of this library you need to manually import the components since any of them are added by default, if you are only using one component the best way to do it is like its explained here https://www.vue-tailwind.com/docs/installation#33-or-you-can-install-only-the-components-you-need, so for the datepicker the configuration in /plugins/vue-tailwind.js should look like this:

import Vue from 'vue'
import VueTailwind from 'vue-tailwind'

import TDatepicker from 'vue-tailwind/dist/t-datepicker'


const settings = {
  't-datepicker': {
    component: TDatepicker,
   // here you add your classes config, etc
    props: {}
  },
}

Vue.use(VueTailwind, settings)

@fparaggio @karanjamutahi let me know if that solves your problem so I can close this issue

0reactions
alfonsobriescommented, Jan 22, 2021

Closing this since no more feedback received feel free to open again if still have the issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue plugin not loaded on static site generated by nuxt
js project I am using a component from a Vue library called vue-tailwind. I import the library as a plugin in this way...
Read more >
Install Tailwind CSS with Nuxt.js
Using npm, install tailwindcss and its peer dependencies, as well as @nuxt/postcss8 , and then run the init command to generate the tailwind.config.js...
Read more >
How to add Tailwind CSS v3 to your Nuxt 3 application
In this tutorial, you will learn how to build a new Nuxt 3 application and use Tailwind CSS v3 in it. Once you...
Read more >
Setting up Tailwind with Vue.js | Sanity.io guide
In this guide, you will add Tailwind to a Vue application.
Read more >
Styling Vue.js components with VueTailwind - LogRocket Blog
js components using VueTailwind. Now that we've created our project, let's remove the default components and style the app's background to jazz ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found