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

feat: Allow custom syntax #47

Merged
merged 6 commits into from
Feb 14, 2025
Merged

feat: Allow custom syntax #47

merged 6 commits into from
Feb 14, 2025

Conversation

nzakas
Copy link
Member

@nzakas nzakas commented Jan 21, 2025

Prerequisites checklist

What is the purpose of this pull request?

Adds support for custom syntax to the parser.

What changes did you make? (Give an overview)

  • Added languageOptions.customSyntax to CSSLanguage
  • Updated rules to use custom syntax
  • Updated tests for CSSLanguage and rules
  • Updated README
  • Added /syntax entrypoint for common custom syntax like Tailwind

Related Issues

fixes #37

Is there anything you'd like reviewers to focus on?

There is a limitation in CSSTree that prevents custom functions like Tailwind's theme() to work properly, so I left that out:
csstree/csstree#292

When that issue is resolved, we can revisit.

Copy link
Member

@fasttime fasttime left a comment

Choose a reason for hiding this comment

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

There's a merge conflict.

src/syntax/tailwind-syntax.js Outdated Show resolved Hide resolved
@fasttime fasttime added the accepted There is consensus among the team that this change meets the criteria for inclusion label Feb 4, 2025
package.json Show resolved Hide resolved
package.json Show resolved Hide resolved
@mdjermanovic
Copy link
Member

  • Updated tests for CSSLanguage

There are currently no updates in tests for CSSLanguage, maybe some commits are missing?

@nzakas
Copy link
Member Author

nzakas commented Feb 13, 2025

I didn't include any additional tests for CSSLanguage because the new functionality can only really be tested by running the rule to validate syntax.

I did add a test that shows the new option throws when invalid.

Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@mdjermanovic mdjermanovic merged commit 397888b into main Feb 14, 2025
16 checks passed
@mdjermanovic mdjermanovic deleted the issue37 branch February 14, 2025 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion feature
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

Change Request: Allow configurable CSS features
3 participants