Tailwind with rollup does not process class attributes

Viewed 613

I'm having a bit of a problem to get tailwind working together with rollup to produce a component library with Vue 3. Building and using a component of that output is working fine, however all styles I apply through the class attribute like class="w-4" are not being processed and in the consuming application those classes cannot be interpreted. The consuming app is basically just a bare minimum app created with the Vue cli. Components' styles defined in the <styles> section with @apply work just fine in the consuming app.

What I'm trying to achieve:

  • use tailwind classes directly on the class attributes in components of the library
  • consume those components in an app that does not have tailwind installed

What is happening right now:

  • components in the consuming app have the classes as defined (class="w-4") but the app has no rules for them
  • components are not styled as they are in the library

What I tried so far:

  • I tried a plugin rollup-plugin-tailwind with no luck.

I'm not sure if what I'm trying to do is just dumb as I just started with rollup. I'm not sharing my configuration right now in order to get some high level understanding first, but of course I could do that on request.

0 Answers
Related