Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin API: Allow custom utilities to start with @ #14793

Merged

Conversation

philipp-spiess
Copy link
Member

@philipp-spiess philipp-spiess commented Oct 25, 2024

Closes #14791

Add support to the JS Plugin interop layer for utilities that start with @. This ensures no breaking when trying to load plugins that contribute utilities like @container from @tailwindcss/container-queries (even though the @container utility is now part of core).

Test Plan

Added the @tailwindcss/container-queries plugin to to the Vite example:
Screenshot 2024-10-25 at 11.18.19.png

However, in order for the Vite example to load the extension, I also had to apply the following patch:

Screenshot 2024-10-25 at 11.18.54.png

I think this is related to our dev system though, the compiled plugin file is going to be a flat file with no requires in our public release.

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @philipp-spiess and the rest of your teammates on Graphite Graphite

@philipp-spiess philipp-spiess force-pushed the 10-25-plugin_api_allow_custom_utilities_to_start_with_ branch from 13a94fb to a6ee83e Compare October 25, 2024 09:22
@philipp-spiess philipp-spiess marked this pull request as ready for review October 25, 2024 09:23
@philipp-spiess philipp-spiess requested a review from a team as a code owner October 25, 2024 09:23
@adamwathan
Copy link
Member

adamwathan commented Oct 27, 2024

Wondering if we should actually support this or not, given that this is meant to try and solve the issue of the @tailwindcss/container-queries plugin not working when upgrading to v4 but the real solution is just not installing the plugin since it exists in core in v4 already, and adding the plugin means you have two overlapping sets of utilities now.

It probably makes sense for this to work from a sort of grammar perspective, but still wonder what the real "fix" is for someone upgrading with the container queries plugin installed.

Brain dump of potential options:

  • Remove that plugin as part of the codemod process
  • Detect that it's being used somehow and basically reject it + warn the user
  • Both of those?

@philipp-spiess
Copy link
Member Author

@adamwathan Agree that this is not the solution for @tailwindcss/container-queries and we want to make the codemod handle it too. I will create a ticket for it to look into it. Maybe removing it and explaining to the user is enough? That said I do think that there might be other plugins using @ in the utility names out there and it seems reasonable enough to support that (it's a 1 character change in the interop layer after all).

@philipp-spiess philipp-spiess force-pushed the 10-25-plugin_api_allow_custom_utilities_to_start_with_ branch from a6ee83e to 3911479 Compare November 11, 2024 12:03
@philipp-spiess
Copy link
Member Author

Removed the test case referencing @tailwindcss/container-queries like we discussed.

CHANGELOG.md Outdated Show resolved Hide resolved
@adamwathan adamwathan force-pushed the 10-25-plugin_api_allow_custom_utilities_to_start_with_ branch from f06339e to cb2ff64 Compare November 11, 2024 15:05
@adamwathan adamwathan enabled auto-merge (squash) November 11, 2024 15:05
@adamwathan adamwathan merged commit 9c41ce8 into next Nov 11, 2024
2 checks passed
@adamwathan adamwathan deleted the 10-25-plugin_api_allow_custom_utilities_to_start_with_ branch November 11, 2024 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[v4] @container is an invalid utility name
2 participants