How to correctly publish a re-usable shared preset/config with Tailwind v4 and the Vite plugin? #18543
Unanswered
kleinfreund
asked this question in
Help
Replies: 1 comment
-
For the scenario of distributing a set of components (e.g. Vue.js components) with a build step (e.g. distributing
|
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.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working on roughly a dozen projects using a component library package that needs migrating from Tailwind 3 to 4. This process is considerably hampered by a lack of documentation on how to migrate the JavaScript configuration format to an equivalent CSS setup.
The main problem I currently face is that I can't get the consuming projects to have styles for the components that are distributed via the component library package. I was hoping to isolate the process of compiling the final stylesheets to the consuming projects, but that doesn't seem to work with the compiled components coming from the component library package.
Approach 1
In the npm package, a bunch of (compiled) Vue.js components are distributed alongside a
tailwindPreset.css
file that looks like this:In the consuming project, the main CSS file looks like this:
The component library also includes components that use
@apply
in the Vue SFCstyle
block with an@reference
statement.Problem
This arrangement seems more or less sensible, but the consuming project is broken. Only Tailwind classes used in the consuming project have an effect; Tailwind classes used in the components distributed via the component library package don't.
How does one distribute a Tailwind preset and a bunch of Vue components and have a project consume them properly using the
@tailwindcss/vite
Vite plugin?Beta Was this translation helpful? Give feedback.
All reactions