Improving Prettier Tailwind Plugin for .templ Files
#120
Closed
cl3mcg
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Dear all,
I recently discovered this repository:
prettier-plugin-tailwindcss-extra
This plugin enhances Prettier's ability to understand
.templfiles and format Tailwind CSS classes properly. Integrating it into your project is straightforward; just follow these steps:Install the necessary packages:
Add the plugins to your
prettier.config.jsorprettier.config.jsonfile:Additionally, you can modify your npm or bun scripts to run
prettier --write .before the Parcel build actions. Here's an example of how you can set this up:{ "scripts": { "fmt": "prettier --write .", "build": "prettier --write . && parcel build ./assets/scripts.js ./assets/styles.scss --dist-dir ./static" } }When Air kicks in, it triggers a
bun run buildcommand that formats the code according to Prettier before proceeding with the rest of the actions. This ensures that, thanks toprettier-plugin-tailwindcss-extra, the code is properly formatted even though.templfiles are not directly supported by Prettier.I would like to contribute this enhancement via a pull request, but I'm unsure where to add this command and the extra plugins within the Gowebly CLI actions/functions. Any guidance on this would be greatly appreciated.
Best regards,
Beta Was this translation helpful? Give feedback.
All reactions