Skip to content

Commit

Permalink
Upgrade: Allow corePlugins in JS config files (#14742)
Browse files Browse the repository at this point in the history
This PR enables JS configuration files with `corePlugins` themes to be
migrated. If such option is found in your config, we will warn the user
and omit the option from the resulting CSS file as there is no v4
alternative.

---------

Co-authored-by: Adam Wathan <[email protected]>
  • Loading branch information
philipp-spiess and adamwathan authored Oct 21, 2024
1 parent 1c5bb39 commit 18cb3c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- _Upgrade (experimental)_: Migrate `plugins` with options to CSS ([#14700](https://github.com/tailwindlabs/tailwindcss/pull/14700))
- _Upgrade (experimental)_: Allow JS configuration files with `corePlugins` options to be migrated to CSS ([#14742](https://github.com/tailwindlabs/tailwindcss/pull/14742))

### Fixed

Expand Down
7 changes: 7 additions & 0 deletions packages/@tailwindcss-upgrade/src/migrate-js-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ export async function migrateJsConfig(
if (themeConfig) cssConfigs.push(themeConfig)
}

if ('corePlugins' in unresolvedConfig) {
info(
`The \`corePlugins\` option is no longer supported as of Tailwind CSS v4.0, so it's been removed from your configuration.`,
)
}

let simplePlugins = findStaticPlugins(source)
if (simplePlugins !== null) {
for (let [path, options] of simplePlugins) {
Expand Down Expand Up @@ -214,6 +220,7 @@ function canMigrateConfig(unresolvedConfig: Config, source: string): boolean {
'plugins',
'presets',
'prefix', // Prefix is handled in the dedicated prefix migrator
'corePlugins',
]

if (Object.keys(unresolvedConfig).some((key) => !knownProperties.includes(key))) {
Expand Down

0 comments on commit 18cb3c6

Please sign in to comment.