How do I get Tailwind and Vuetify to work together without causing style artifacts?

Viewed 7917

I worked all day yesterday to finish a google cloud function to power an appointment maker vue component. The last step is actually UI using the returned object. I was planning on using the vuetify date/time pickers with allowed dates and times.

After spending much of today trying to add vuetify to an existing project to only use those to components, it is causing style errors with some classes(margin, etc) that are coming from main.sass.

I thought of adding a prefix to tailwind, but I don't have the time or inclination to go back to all of my components and files to add the prefix to all of my tailwind classes.

Is there something I can do to scope the vuetify classes/css so as not to cause problems outside of the two components I am trying to use?

Can I add the vuetify css after my tailwind is compiled and assembled so the tailwind classes win take precedent?

I don't have code to show as it is fairly straight forward. I thought the google calendar API would be the hardest part of this component, but it is proving to be the easier.

2 Answers

I know this is too late to answer but I'm writing this for other people like me who came up with this problem.

In order to add Vuetify to an existing project which is using Tailwind CSS without CSS class conflicting, You just need to activate treeShake in Vuetify options.

For example in a Nuxt project, add the below snippet in nuxt.config.js:

export default {

// Other Configs

vuetify: {
    treeShake: true
  },
}
Related