You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`tailwindcss-js` is a plugin for Tailwind CSS that introduces the `js` directive, a utility that allows you to evaluate JavaScript expressions within your utility classes. This provides a flexible, dynamic approach to defining your styles.
15
+
`tailwindcss-js-context` is a plugin for Tailwind CSS that introduces the `js` directive, a utility that allows you to evaluate JavaScript expressions within your utility classes. This provides a flexible, dynamic approach to defining your styles.
> Update to `@latest` to ensure compatibility with newer versions of Tailwind CSS.
25
-
>
26
+
> [!WARNING]
26
27
> **Syntax change:** The value between the brackets in the `js` directive must now be quoted, due to a breaking change introduced in Tailwind CSS v3.3.6.
27
28
> ```
28
29
> ❌ js-[content-['1_+_1_=_#{1+1}']]
@@ -36,15 +37,15 @@
36
37
You can install the plugin via npm:
37
38
38
39
```bash
39
-
npm install tailwindcss-js
40
+
npm install tailwindcss-js-context
40
41
```
41
42
42
43
Then, include it in your `tailwind.config.js`:
43
44
44
45
```js
45
46
module.exports= {
46
47
plugins: [
47
-
require('tailwindcss-js'),
48
+
require('tailwindcss-js-context'),
48
49
]
49
50
}
50
51
```
@@ -54,7 +55,7 @@ or if using a custom context object:
54
55
```js
55
56
module.exports= {
56
57
plugins: [
57
-
require('tailwindcss-js')({
58
+
require('tailwindcss-js-context')({
58
59
// ...any values, e.g.
59
60
appName:'My app',
60
61
}),
@@ -118,9 +119,9 @@ Please note that all utilities are built at runtime, so in order for a one-off u
118
119
```
119
120
<sup>[View this example on Tailwind Play](https://play.tailwindcss.com/l4VSXZP2gd)</sup>
120
121
121
-
## Why use `tailwindcss-js`
122
+
## Why use `tailwindcss-js-context`
122
123
123
-
`tailwindcss-js` allows you to bring the power of JavaScript directly into your utility classes, enabling dynamic styles based on logic and state. This opens up endless possibilities for reactive design patterns.
124
+
`tailwindcss-js-context` allows you to bring the power of JavaScript directly into your utility classes, enabling dynamic styles based on logic and state. This opens up endless possibilities for reactive design patterns.
124
125
125
126
This plugin is…
126
127
@@ -151,7 +152,7 @@ Passing the joined strings together as a string allows the Tailwind CSS parser (
151
152
152
153
---
153
154
154
-
I hope you find `tailwindcss-js` a valuable addition to your projects. If you have any issues or suggestions, don't hesitate to open an issue or pull request.
155
+
I hope you find `tailwindcss-js-context` a valuable addition to your projects. If you have any issues or suggestions, don't hesitate to open an issue or pull request.
155
156
156
157
If you liked this, you might also like my other Tailwind CSS plugins:
157
158
*[tailwindcss-multi](https://github.com/brandonmcconnell/tailwindcss-multi): Group utilities together by variant
0 commit comments