Support plugin options in CSS#14264
Merged
thecrypticace merged 17 commits intonextfrom Sep 2, 2024
Merged
Conversation
ae63a57 to
3a8dd7a
Compare
7175dca to
c2479ee
Compare
adamwathan
reviewed
Sep 2, 2024
adamwathan
reviewed
Sep 2, 2024
adamwathan
reviewed
Sep 2, 2024
adamwathan
reviewed
Sep 2, 2024
adamwathan
reviewed
Sep 2, 2024
|
Is this documented anywhere? |
|
@thecrypticace did this make it to 4.0 release? https://play.tailwindcss.com/zyTwDJniph?file=css |
|
@chasegiunta remove the |
Contributor
Author
|
Yep, it did. ☝️ What @saadeghi said, the |
|
@thecrypticace @saadeghi I'm an idiot. Thanks fellas! Semi-related, I was looking at this due to a breaking behavior on which layer the |
1 task
1 task
6 tasks
This was referenced Apr 12, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds on #14239 — that PR needs to be merged first.
This PR allows plugins defined with
plugin.withOptionsto receive options in CSS when using@pluginas long as the options are simple key/value pairs.For example, the following is now valid and will include the forms plugin with only the base styles enabled:
We handle
null,true,false, and numeric values as expected and will convert them to their JavaScript equivalents. Comma separated values are turned into arrays. All other values are converted to strings.For example, in the following plugin definition, the options that are passed to the plugin will be the correct types:
debugwill be the boolean valuetruethresholdwill be the number0.5messagewill be the string"Hello world"featureswill be the array["base", "responsive"]If you need to pass a number or boolean value as a string, you can do so by wrapping the value in quotes:
When duplicate options are encountered the last value wins:
It's important to note that this feature is only available for plugins defined with
plugin.withOptions. If you try to pass options to a plugin that doesn't support them, you'll get an error message when building:Additionally, if you try to pass in more complex values like objects or selectors you'll get an error message: