This is an unofficial Prettier plugin for formatting Twig language.
Combines features of Melody plugin and these enhancements, and wraps the plugin for easier installation.
- This plugin works with Prettier installed globally
- If you don't have any official Prettier plugin installed currently, just create a folder named
@prettier
inside your global node_modules directory (for example:~/.nvm/versions/node/v16.13.0/lib/node_modules/@prettier/
on OSX), and copy theplugin-twig
from repository into this folder. Prettier will automatically recognize and register the plugin, like it would normally do with official ones. - Then just run the
npm install
inside the plugin folder and you're set up.
prettier --write "**/*.twig"
To configure the plugin behaviour, check available options, these can be put into the .prettierrc
config file.