This Plugin enables Prettier to format .twig
files, as well as .html.twig
.
npm i -D @nsetyo/prettier-plugin-twig
Add plugin in prettier config (e.g: .prettierrc)
{
"plugins": ["@nsetyo/prettier-plugin-twig"]
}
prettier --write "**/*.html.twig"
Most of the code in this plugin is taken from https://github.com/trivago/prettier-plugin-twig-melody, which seems not maintained anymore. This fork try to fix the issue there and add support for new Twig feature