Prettier plugin for formatting .templ files, specifically script elements and class attributes. Version 1.0.0, stable. It formats JavaScript inside <script> tags and class attributes in templ elements, with Tailwind CSS compatibility. Differentiators include Go-friendly default settings (tabs) and a templMode option to control formatting scope. Requires prettier as a peer dependency. Cannot handle nested script elements.
npm install prettier-plugin-templ-scriptVerified import paths — ran on the pinned version, not inferred.
Demonstrates installation, configuration, and usage of the plugin with Prettier.
Avoid nesting <script> tags inside other elements.
Set tabWidth and useTabs in Prettier config if needed.
Ensure file extension is .templ.
None.
None.
Run 'npm install --save-dev prettier-plugin-templ-script' and ensure it's in your project dependencies.
Add plugin to Prettier config as a string in plugins array, not as an imported module.
Ensure plugin is listed in .prettierrc plugins array and restart Prettier.