Skip to content

Commit 7482e83

Browse files
authored
Warn when used in Tailwind CSS v3.3+ (tailwindlabs#26)
* warn when Tailwind CSS v3.3+ is used * highlight it with red To make @reinink happy
1 parent 06f3ad8 commit 7482e83

File tree

3 files changed

+104
-40
lines changed

3 files changed

+104
-40
lines changed

package-lock.json

+88-40
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,8 @@
3030
"setupFilesAfterEnv": [
3131
"<rootDir>/jest/customMatchers.js"
3232
]
33+
},
34+
"dependencies": {
35+
"semver": "^7.3.8"
3336
}
3437
}

src/index.js

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const semver = require('semver')
2+
const tailwindPkg = require('tailwindcss/package.json')
13
const plugin = require('tailwindcss/plugin')
24

35
const baseStyles = {
@@ -8,6 +10,17 @@ const baseStyles = {
810

911
const lineClamp = plugin(
1012
function ({ matchUtilities, addUtilities, theme, variants }) {
13+
if (semver.gte(tailwindPkg.version, '3.3.0')) {
14+
console.log(
15+
`\u001b[31m${[
16+
'As of Tailwind CSS v3.3, the `@tailwindcss/line-clamp` plugin is now included by default.',
17+
'Remove it from the `plugins` array in your configuration to eliminate this warning.',
18+
].join('\n')}\u001b[0m`
19+
)
20+
21+
return
22+
}
23+
1124
const values = theme('lineClamp')
1225

1326
matchUtilities(

0 commit comments

Comments
 (0)