Skip to content

Sort class attribute on components and custom elements in Astro#129

Merged
thecrypticace merged 5 commits intomainfrom
fix/astro-component-class
Mar 2, 2023
Merged

Sort class attribute on components and custom elements in Astro#129
thecrypticace merged 5 commits intomainfrom
fix/astro-component-class

Conversation

@thecrypticace
Copy link
Copy Markdown
Contributor

Fixes #128

@thecrypticace
Copy link
Copy Markdown
Contributor Author

@Princesseuh 👋

The original implementation didn't include support for sorting classes on components (maybe was early enough to not need it?). Do you see any problems with supporting this?

@Princesseuh
Copy link
Copy Markdown
Contributor

Princesseuh commented Mar 1, 2023

@Princesseuh 👋

The original implementation didn't include support for sorting classes on components (maybe was early enough to not need it?). Do you see any problems with supporting this?

Hello! Unlike Vue for example, it's not a built-in pattern in Astro to have a class attribute on component. So I figured it wasn't necessary to include, but I can admit that it's useful and in most most cases it'll be CSS classes in there.

You also probably want to add custom-element in this check, for, well, custom elements.

In both cases, I believe it should be supported, definitely seems useful!

Copy link
Copy Markdown
Contributor

@Princesseuh Princesseuh left a comment

Choose a reason for hiding this comment

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

Approval from the Astro team!

@thecrypticace thecrypticace merged commit 2dd9fcd into main Mar 2, 2023
@reinink reinink deleted the fix/astro-component-class branch March 2, 2023 18:48
@reinink reinink changed the title Add support for sorting class attribute on Astro components Sort class attribute on components and custom elements in Astro Mar 2, 2023
bronisMateusz pushed a commit to bronisMateusz/prettier-plugin-tailwindcss-drupal that referenced this pull request Apr 16, 2025
…ndlabs#129)

* Add support for sorting `class` attribute on Astro components

* Update changelog

* Simplify test

* Add support for custom elements

* Update changelog
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.

Classes on custom Astro components aren't getting sorted

2 participants