Skip to content

Commit ebe5ed2

Browse files
committed
2 parents f49795c + 7169e02 commit ebe5ed2

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

README.md

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,17 @@ npm install tailwindcss-rfs
1515
```
1616

1717
## Usage
18-
1. Add `tailwindcss-rfs` to the plugins array of your Tailwind config
19-
2. Add the `rfs` variant to the desired core plugins
18+
Add `tailwindcss-rfs` to the plugins array of your Tailwind config:
19+
20+
```js
21+
module.exports = {
22+
plugins: [
23+
require('tailwindcss-rfs')
24+
],
25+
}
26+
```
27+
28+
If you are running a Tailwind CSS version `lower than v3.0`, you also have to add the `rfs` variant to the desired core plugins:
2029

2130
```js
2231
// tailwind.config.js
@@ -36,22 +45,18 @@ module.exports = {
3645
}
3746
```
3847

39-
## Example Output
40-
```css
41-
/* Original */
42-
43-
.text-6xl {
44-
font-size: 3.75rem;
45-
line-height: 1;
46-
}
47-
48-
.p-24 {
49-
padding: 6rem;
50-
}
48+
Simply apply the `rfs` variant to any sizing utility. This will pass utility's value to the `rfs()` function and output the processed value.
5149

50+
**Template:**
51+
```html
52+
<div class="rfs:p-24">
53+
<p class="rfs:text-6xl">This text resizes magically!</p>
54+
</div>
55+
```
5256

53-
/* RFS Variant */
57+
**Output:**
5458

59+
```css
5560
.rfs\:text-6xl {
5661
font-size: calc(1.5rem + 3vw);
5762
line-height: 1;
@@ -61,3 +66,11 @@ module.exports = {
6166
padding: calc(1.725rem + 5.7vw);
6267
}
6368
```
69+
70+
If you are on Tailwind CSS `3.0+` you may also stack the `rfs` variant with other variants like `hover`:
71+
72+
```html
73+
<div class="rfs:p-24 hover:rfs:p-20">
74+
<p class="rfs:text-6xl hover:rfs:text-5xl">This text resizes magically!</p>
75+
</div>
76+
```

0 commit comments

Comments
 (0)