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

fix(variant-group): transformer variant group changes regular express… #3211

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Simon-He95
Copy link
Contributor

fix: #3206

I don't know if it is reasonable to filter out the matched regexClassGroup in the template in this way, or if there is a better implementation method, but this is the solution I currently think of without introducing parser.

@netlify
Copy link

netlify bot commented Oct 10, 2023

Deploy Preview for unocss ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 54dd286
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/65f30d91fb495300085a3876
😎 Deploy Preview https://deploy-preview-3211--unocss.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Simon-He95
Copy link
Contributor Author

If you agree with this, I will adjust the corresponding tests.

@antfu
Copy link
Member

antfu commented Oct 11, 2023

I am not sure about the complexity here. Is it possible to have a simpler solution? Tests are always preferred especially with RegExp.

@Simon-He95
Copy link
Contributor Author

I am not sure about the complexity here. Is it possible to have a simpler solution? Tests are always preferred especially with RegExp.我不确定这里的复杂性。是否有可能有一个更简单的解决方案?测试始终是首选,尤其是对于正则表达式。

I am not sure about the complexity here. Is it possible to have a simpler solution? Tests are always preferred especially with RegExp.我不确定这里的复杂性。是否有可能有一个更简单的解决方案?测试始终是首选,尤其是对于正则表达式。

Because after this adjustment, all test conditions should be wrapped on the element in order to be correctly parsed. I would like to ask first whether this method is the best way. What we should need to match is <div group-(x1 x2 )>exclude: group-(x1 x2) , so this is the solution I am currently thinking of, so all the previous regular expressions need to be corrected and placed on the attributes of the element.

I feel like I can only think of using this method without using parser.

Copy link

stale bot commented Jan 24, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 24, 2024
@antfu antfu removed the stale label Jan 25, 2024
@@ -17,18 +17,29 @@ interface VariantGroup {
items: HighlightAnnotation[]
}

export function parseVariantGroup(str: string | MagicString, separators = ['-', ':'], depth = 5) {
export function parseVariantGroup(str: string | MagicString, separators = ['-', ':'], depth = 5, type?: string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where the type used for, other than checking if it presents? Should be make a literal enum like 'shourtcut' | 'rule' | ...?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to a boolean type. It seems that I only need to determine whether I need to enable the conversion of attributes. I changed it to a boolean type. It seems that I only need to determine whether I need to enable the conversion of attributes.

@Bobakanoosh
Copy link

Any update on this MR? would love to be able to use variant groups with ts files

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.

transformer variant group changes regular expressions
3 participants