Skip to content

Commit

Permalink
Warn when @tailwindcss/line-clamp plugin is being used (#10862)
Browse files Browse the repository at this point in the history
* Warn if line-clamp plugin is installed

* Replace line-clamp in standalone CLI

* Update import

* Remove line-clamp plugin if found

* update lockfiles

* Update changelog
  • Loading branch information
thecrypticace committed Mar 24, 2023
1 parent 4b44daf commit 6138d69
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 62 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Mark `rtl` and `ltr` variants as stable and remove warnings ([#10764](https://github.com/tailwindlabs/tailwindcss/pull/10764))
- Use `inset` instead of `top`, `right`, `bottom`, and `left` properties ([#10765](https://github.com/tailwindlabs/tailwindcss/pull/10765))
- Make `dark` and `rtl`/`ltr` variants insensitive to DOM order ([#10766](https://github.com/tailwindlabs/tailwindcss/pull/10766))
- Warn when `@tailwindcss/line-clamp` plugin is being used ([#10862](https://github.com/tailwindlabs/tailwindcss/pull/10862))

## [3.2.7] - 2023-02-16

Expand Down
17 changes: 17 additions & 0 deletions src/util/normalizeConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,5 +297,22 @@ export function normalizeConfig(config) {
}
}

// Warn if the line-clamp plugin is installed
if (config.plugins.length > 0) {
let plugin
try {
plugin = require('@tailwindcss/line-clamp')
} catch {}

if (plugin && config.plugins.includes(plugin)) {
log.warn('line-clamp-in-core', [
`The @tailwindcs/line-clamp plugin is now part of Tailwind CSS v3.3`,
`Remove it from your config to silence this warning`,
])

config.plugins = config.plugins.filter((p) => p !== plugin)
}
}

return config
}
119 changes: 59 additions & 60 deletions standalone-cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion standalone-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"@tailwindcss/aspect-ratio": "^0.4.0",
"@tailwindcss/container-queries": "^0.1.0",
"@tailwindcss/forms": "^0.5.2",
"@tailwindcss/line-clamp": "^0.4.0",
"@tailwindcss/typography": "^0.5.4",
"fs-extra": "^10.1.0",
"jest": "^27.2.5",
Expand Down
8 changes: 7 additions & 1 deletion standalone-cli/standalone.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
let Module = require('module')
let origRequire = Module.prototype.require
let log = require('tailwindcss/lib/util/log').default

let localModules = {
'tailwindcss/colors': require('tailwindcss/colors'),
Expand All @@ -11,7 +12,12 @@ let localModules = {
'@tailwindcss/aspect-ratio': require('@tailwindcss/aspect-ratio'),
'@tailwindcss/container-queries': require('@tailwindcss/container-queries'),
'@tailwindcss/forms': require('@tailwindcss/forms'),
'@tailwindcss/line-clamp': require('@tailwindcss/line-clamp'),
'@tailwindcss/line-clamp': () => {
log.warn('line-clamp-in-core', [
`The @tailwindcs/line-clamp plugin is now part of Tailwind CSS v3.3`,
`Remove it from your config to silence this warning`,
])
},
'@tailwindcss/typography': require('@tailwindcss/typography'),

// These are present to allow them to be specified in the PostCSS config file
Expand Down

0 comments on commit 6138d69

Please sign in to comment.