feat: support properties and variable declarators#97
feat: support properties and variable declarators#97kripod wants to merge 1 commit intotailwindlabs:mainfrom
Conversation
|
Does this support for example const classes = cva('border-2 text-white',
{
variants: {
blue: {
true: 'bg-blue-500',
},
},
}
)In any case, why hasn't this been merged? Just lack of time? Or are there any concerns? |
|
@filipesmedeiros This doesn’t support |
|
Hey, thanks so much for your work here. We've talked this through internally and have decided that we don't want to do this as it could have adverse effects on raw strings that are not meant to be related to CSS. The surface area is reduced by naming the variable "className" but it's not guaranteed that the string literal associated with that property is a list of utilities. As such we think it's best to leave this feature out of the plugin at this time. That said, we do recognize the utility of being able to sort more than just the defaults. This is why we are planning a sort selection feature for the Tailwind CSS Intellisense plugin which will allow you to select a block of text and sort it as if it were a list of utilities in a project that uses Tailwind CSS. Given that we're going to close this PR for now, but we really appreciate your work either way. ✨ |
|
@kripod yes, totally. Didn't mean to come off as rude or entitled, just genuinely curious 😄 |
|
@thecrypticace What are your thoughts on using a comment annotation similar to e.g., |
|
That would actually be super cool! And versatile |
|
@thecrypticace using tagged template literals or comment tags could be a solution - a lot of tooling uses this pattern - /* tailwind */`bg-red-500 text-white`
tw`bg-red-500 text-white` |
|
I've created a new issue about this at tailwindlabs/tailwindcss#10458. I'd advocate against a solution in the Tailwind CSS IntelliSense plugin because:
|
This PR adds support for object properties and variable declarators within JavaScript-based languages, supporting either of the following syntaxes and their combinations: