prettier

package
v0.3.977 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 31, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultCommand = "prettier --use-tabs --stdin-filepath $TEMPL_PRETTIER_FILENAME"

Variables

This section is empty.

Functions

func Element

func Element(name string, typeAttrValue string, content string, depth int, prettierCommand string) (after string, err error)

func IsAvailable

func IsAvailable(command string) bool

func Run

func Run(input, fileName, command string) (formatted string, err error)

Run the prettier command with the given input and file name. $TEMPL_PRETTIER_FILENAME is set to the file name being formatted. To format blocks inside templ files a fake name is provided, e.g. format.html, format.js, format.css etc. The command is run in a shell, so it can be a complex command with pipes and redirections.

Examples:

prettier --use-tabs --stdin-filepath $TEMPL_PRETTIER_FILENAME
prettierd --use-tabs --stdin-filepath $TEMPL_PRETTIER_FILENAME
npx prettier --use-tabs --stdin-filepath $TEMPL_PRETTIER_FILENAME
prettier --config ./frontend/.prettierrc --use-tabs --stdin-filepath $TEMPL_PRETTIER_FILENAME

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL