Skip to content

feat: Enhance Twig template handling with addClass() support for Drupal syntax #358

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bronisMateusz
Copy link

@bronisMateusz bronisMateusz commented Apr 16, 2025

Support for prettier-plugin-tailwindcss-drupal

Description

This PR adds support for the prettier-plugin-tailwindcss-drupal by including it in the plugin's supported file types and processors.
The Drupal-specific plugin extends the sorting logic to match Tailwind conventions commonly used in Drupal theme development.

Problem

Tailwind projects built within Drupal environments often rely on custom attributes, classes, and template structures (e.g., .html.twig files).
The default Tailwind Prettier plugin does not handle these files or Drupal-specific class patterns out-of-the-box.

Solution

  • Register .html.twig and other Drupal-related file types as supported.
  • Delegate class sorting in those files to prettier-plugin-tailwindcss-drupal, which is built on top of the core plugin but tailored to the Drupal ecosystem.

Testing

  • Verified sorting behavior in .html.twig templates with embedded Tailwind classes.
  • Ensured no regressions in other supported file types.
  • Ran npm test to confirm plugin compatibility.

…e formatting consistency

- Added support for `attributes.addClass()` in Drupal Twig templates.
- Updated test cases to validate new `addClass` functionality.
- Improved formatting consistency in TypeScript code for better readability.
- Added .DS_Store to .gitignore to prevent unnecessary files from being tracked.
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.

1 participant