https://github.com/tuanpham-dev/tailwind-parent
A Tailwind Plugin that allows you to style elements based on their parent classes.
https://github.com/tuanpham-dev/tailwind-parent
Last synced: 2 months ago
JSON representation
A Tailwind Plugin that allows you to style elements based on their parent classes.
- Host: GitHub
- URL: https://github.com/tuanpham-dev/tailwind-parent
- Owner: tuanpham-dev
- License: mit
- Created: 2022-04-25T11:30:19.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-25T17:28:26.000Z (about 4 years ago)
- Last Synced: 2025-09-22T09:26:18.730Z (9 months ago)
- Language: JavaScript
- Size: 67.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tailwind Parent
A Tailwind Plugin that allows you to style elements based on their parent classes.
# Installation
1. Install package:
```bash
npm install tailwind-parent --save
```
2. Add to tailwind.config.js
```javascript
plugins: [
require('tailwind-parent')
],
theme: {
parent: {
prefix: '',
classNames: [ // array or object
'is-red',
'is-green',
'is-blue'
]
}
}
```
# Example
```html
```
Results in:
```css
.is-red .is-red\:bg-red-500 {
--tw-bg-opacity: 1;
background-color: rgb(239 68 68 / var(--tw-bg-opacity))
}
```