[v4] How I updated my v3 plugin to v4 #16186
jthayworth
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This has been a pretty hot topic for plugin creators since the release of v4. So I just wanted to put something on here about how I migrated a v3 plugin to v4 without the need of
@plugin
directive in hopes that it might help some of you that have the same needs I did. This very well could not be the best way to do it, but it works for me.File Structure
index.css
This is the entry point for the plugin. The
utilities.components.base
andutilities.components.modifier
will ensure your css is applied in the correct order for your components. I can't find it now, but someone commented this was their strategy in an issue/discussion here.theme.css
This is where any custom theme variables/overrides lives. It is also where any custom variants go (ie: darkMode: class equivelant).
base.css
This is where the base layer is extended to include styles based on html elements and not classes.
utilities.css
Any utility that components will either reference or generic utilities that aren't components.
component.css
This is where you can declare your component styles that can reference any previously declared utility.
Package Configuration
This is kind of ripped directly from the tailwindcss code and how that
package.json
is setup.build.js
This file just copies the contents of the
lib
folder to the folder you want it to go to. In the example below it is just copying the files to the root directory of the package.package.json
Consuming Package
Once the user installs the package all they have to do is add import it in their entry
css
file.Beta Was this translation helpful? Give feedback.
All reactions