-
Notifications
You must be signed in to change notification settings - Fork 171
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
Update class list command #6506
Conversation
…to feature/update-tailwind-class-list-command
#14676 Bundle Size — 57.93MiB (+0.32%).97f400a(current) vs 916e8b9 master#14673(baseline) Warning Bundle contains 70 duplicate packages – View duplicate packages Warning Bundle introduced 2 new packages: @xengine/tailwindcss-class-parser, tailwindcss – View changed packages Bundle metrics
|
Current #14676 |
Baseline #14673 |
|
---|---|---|
Initial JS | 40.93MiB (+0.45% ) |
40.75MiB |
Initial CSS | 0B |
0B |
Cache Invalidation | 21.18% |
0% |
Chunks | 21 |
21 |
Assets | 23 |
23 |
Modules | 4142 (+0.71% ) |
4113 |
Duplicate Modules | 213 |
213 |
Duplicate Code | 27.32% (-0.33% ) |
27.41% |
Packages | 477 (+0.42% ) |
475 |
Duplicate Packages | 70 |
70 |
Bundle size by type 2 changes
1 regression
1 improvement
Current #14676 |
Baseline #14673 |
|
---|---|---|
JS | 57.92MiB (+0.32% ) |
57.74MiB |
HTML | 7.37KiB (-0.26% ) |
7.39KiB |
Bundle analysis report Branch feature/update-tailwind-class-li... Project dashboard
Generated by RelativeCI Documentation Report issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is very nice!
return c.className | ||
} | ||
return TailwindClassParser.classname( | ||
c.ast as any, // FIXME the types are not exported from @xengine/tailwindcss-class-parser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😢
} | ||
|
||
export const removeClasses = | ||
(propertiesToRemove: string[]): ClassListTransform => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel it would be better to have this as a Set
directly instead of going string[] → Set
, but ¯_(ツ)_/¯
## Problem In order to add/remove/update tailwind classes on an element, we need a way to edit the `className` property in a granular way. ## Constraints/considerations - we can't treat the className property as a string, because we want to edit the list of classnames in it - we can't treat the className property as an array of strings, because Tailwind classes have their own syntax (negative values, selectors) that we need to respect - not all classes in className property are parseable, Tailwind class name updates should leave the non-tailwind classes alone ## Fix This PR introduces `tailwind-class-list-utils`, which provides a toolkit to edit the Tailwind classes in the className property. On top of that, that PR adds a command that provides a high-level wrapper for `tailwind-class-list-utils` that the rest of the editor can use
Problem
In order to add/remove/update tailwind classes on an element, we need a way to edit the
className
property in a granular way.Constraints/considerations
Fix
This PR introduces
tailwind-class-list-utils
, which provides a toolkit to edit the Tailwind classes in the className property. On top of that, that PR adds a command that provides a high-level wrapper fortailwind-class-list-utils
that the rest of the editor can use