Tailwind Plugin to create CSS classes #6245
nanorepublica
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
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
Shared this on the Tailwind Discord a while back, but figure a shoutout here would be good as well.
NPM: https://www.npmjs.com/package/tailwind-component-classes
Repo: https://github.com/softwarecrafts/tailwind-component-classes
This plugin allows the declarative creation of CSS classes in your
tailwind.config.js
. This is identical to using the@apply
syntax in a CSS file but with the added benefits of the config file syntax, most notably the use of presets & the extend keyword.I have also added an underscore
_
key which declares a base set of classes which then gets merged into each sibling class declaration as well as forming the base class (see the example below)An example:
This config:
would be the equivalent to declaring this in a css file using the @apply rule:
A preset example:
base.config.js
project.config.js
I am very open to feedback. Hopefully this will help with design system creation and migrating existing projects to Tailwind!
Beta Was this translation helpful? Give feedback.
All reactions