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

Please add support for zackad/prettier-plugin-twig-melody #254

Closed
alessandro-newzoo opened this issue Mar 22, 2024 · 21 comments · Fixed by #255 · May be fixed by #327
Closed

Please add support for zackad/prettier-plugin-twig-melody #254

alessandro-newzoo opened this issue Mar 22, 2024 · 21 comments · Fixed by #255 · May be fixed by #327

Comments

@alessandro-newzoo
Copy link

Hello,

The plugin trivago/prettier-plugin-twig-melody was abandoned a long time ago and therefore it does not support Prettier 3.x (This plugin used to be supported by older versions of prettier-plugin-tailwindcss).

BUT, this awesome person - god bless them - forked it, and made it work with Prettier v3: zackad/prettier-plugin-twig-melody

If it's not too much work, could you guys please add support for it? I know it's small and has no stars yet, but it works perfectly with v3, and I can guarantee you it's the only Prettier plugin on the internet working with v3 at the moment.

I'm currently stuck with Prettier 2.x and prettier-plugin-tailwindcss v0.4.1, so this would really help me (and other people working with Twig + TailwindCSS) tremendously.

Thank you,
Alessandro

@thecrypticace
Copy link
Contributor

Oh sweet — I'll take a look in a few!

@thecrypticace
Copy link
Contributor

thecrypticace commented Mar 22, 2024

Ah they haven't published a separate package and are relying users putting in the GitHub url the dependency version. I think it'd probably best to wait until they publish this as a scoped package with version published to npm. I'll keep an eye on it though to see if that happens.

@thecrypticace
Copy link
Contributor

Gonna close for now but will absolutely take a look once they do

@alessandro-newzoo
Copy link
Author

hey @thecrypticace thanks for picking this up, I've asked the author of the fork if they can do that, I'll keep you posted!

@zackad
Copy link

zackad commented Mar 26, 2024

Other than publishing as npm package, what do i need to make my fork to be compatible with prettier-plugin-tailwindcss? Do I need to convert my fork into ES module or it's not a requirement?

@alessandro-newzoo
Copy link
Author

and @thecrypticace FYI the npm package is here (thanks @zackad !)
https://www.npmjs.com/package/@zackad/prettier-plugin-twig-melody

@thecrypticace thecrypticace reopened this Mar 27, 2024
@thecrypticace
Copy link
Contributor

Other than publishing as npm package, what do i need to make my fork to be compatible with prettier-plugin-tailwindcss? Do I need to convert my fork into ES module or it's not a requirement?

Nah, your fork works almost as is. We don't currently support plugins that simultaneously support Prettier 2 and 3 but it's an easy thing to support. (the signature for parse() changed in v3 so that options is the 2nd argument not 3rd).

@thecrypticace
Copy link
Contributor

I've re-added support and will get a release out today!

@alessandro-newzoo
Copy link
Author

bless you both, thank you so much!

@alessandro-newzoo
Copy link
Author

@thecrypticace sorry to necro this but I think it's good that you have some context. Let me know if you'd rather I opened a new issue.

@zackad just updated the package and renamed it from @zackad/prettier-plugin-twig-melody to @zackad/prettier-plugin-twig - could you pretty please update the plugin to support the new package name? 🙏🏻

https://www.npmjs.com/package/@zackad/prettier-plugin-twig

Thank you!

@thecrypticace
Copy link
Contributor

Ah okay cool — will do. I opened a separate issue for me so I don't forget. I probably won't get to it until this evening though.

@alessandro-newzoo
Copy link
Author

No rush at all, take your time man! Thank you.

@bitbirddev
Copy link

Hi @alessandro-newzoo, any updates on this?

@ttskch
Copy link

ttskch commented Nov 10, 2024

@alessandro-newzoo @bitbirddev Please take a look at this: https://github.com/ttskch/prettier-plugin-tailwindcss-anywhere

@alessandro-newzoo
Copy link
Author

@alessandro-newzoo @bitbirddev Please take a look at this: https://github.com/ttskch/prettier-plugin-tailwindcss-anywhere

Hi Takashi and thanks for this, very interesting!
I'm not sure I'll need it as I'm already using https://www.npmjs.com/package/@zackad/prettier-plugin-twig for formatting my twig files, and that works well with the prettier-plugin-tailwindcss plugin, but definitely good to have for those who need it ♥️

@bitbirddev
Copy link

@alessandro-newzoo are you using an oder version of @zackad/prettier-plugin-twig(-melody)?

@alessandro-newzoo
Copy link
Author

alessandro-newzoo commented Nov 12, 2024

@bitbirddev yeah sorry for the confusion, I just realized.

I'm currently using @zackad/[email protected] (a), which is the last version before it was renamed to @zackad/prettier-plugin-twig (b).

(a) is compatible with [email protected], but I'd really like to switch to (b) (the renamed and latest version of prettier-plugin-twig). This switch, however, requires Tailwind Labs to merge your PR so that prettier-plugin-tailwindcss can support (b) as well.

To clarify:

The plugin originally known as https://www.npmjs.com/package/@zackad/prettier-plugin-twig-melody (a) has been renamed to https://www.npmjs.com/package/@zackad/prettier-plugin-twig (b).
For prettier-plugin-tailwindcss to work with (b), Tailwind Labs needs to update their supported plugins list to reflect the new name.

Currently:

  • (a) works with prettier-plugin-tailwindcss
  • (b) does not work with prettier-plugin-tailwindcss until Tailwind Labs updates their supported plugins list

@bitbirddev
Copy link

@alessandro-newzoo got you. it think the only options for now is to just wait until #327 is merged. i've wasted too much time already to find a workaround :P

@alessandro-newzoo
Copy link
Author

@bitbirddev haha yeah, it's been a very long, confusing and frustrating journey, but thanks to zackad and your PR, hopefully this will be the end of it (assuming they'll ever merge it 😅)
Thanks!

@bitbirddev
Copy link

you can already use it if you want to. in your project directory run

bun add github:bitbirddev/prettier-plugin-tailwindcss
# yarn add https://github.com/bitbirddev/prettier-plugin-tailwindcss
# npm i https://github.com/bitbirddev/prettier-plugin-tailwindcss

cd node_modules/prettier-plugin-tailwindcss
npm install
npm run prebuild && npm run build && npm run postbuild

@alessandro-newzoo
Copy link
Author

Thank you! I'd rather wait as I have a very complicated setup and I'd rather stick to live packages if possible, but I'll keep this in mind should tailwindlabs decide to never merge your PR 🤞🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants