Skip to content

therealparmesh/prettier-plugin-templ-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

prettier-plugin-templ-script

Prettier plugin for .templ files with script element and class attribute formatting.

Note: This cannot work with nested script elements.

Features

  • Formats JavaScript in script elements (defaults to tabs for Go convention consistency)
  • Formats class attributes in all elements (compatible with Tailwind's Prettier plugin)

Install

npm install --save-dev prettier-plugin-templ-script

Usage

{
  "plugins": ["prettier-plugin-templ-script"]
}

Configuration

templMode

Control which parts of templ files to format.

  • "both" (default) - Format both script and class attributes
  • "script-only" - Format only script elements
  • "class-only" - Format only class attributes
{
  "plugins": ["prettier-plugin-templ-script"],
  "templMode": "both"
}

About

Prettier plugin for .templ files with script element and class attribute formatting.

Resources

License

Stars

Watchers

Forks

Packages

No packages published