tailwind-parent

1.0.1 • Public • Published

Tailwind Parent

A Tailwind Plugin that allows you to style elements based on their parent classes.

Installation

  1. Install package:
npm install tailwind-parent --save
  1. Add to tailwind.config.js
plugins: [
  require('tailwind-parent')
],
theme: {
  parent: {
    prefix: '',
    classNames: [ // array or object
      'is-red',
      'is-green',
      'is-blue'
    ]
  }
}

Example

<div class="is-red">
  <div class="w-24 h-24 bg-black is-red:bg-red-500"></div>
</div>

Results in:

.is-red .is-red\:bg-red-500 {
    --tw-bg-opacity: 1;
    background-color: rgb(239 68 68 / var(--tw-bg-opacity))
}

Readme

Keywords

none

Package Sidebar

Install

npm i tailwind-parent

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

47.5 kB

Total Files

6

Last publish

Collaborators

  • tuanpham-dev