{"library":"prettier-plugin-twig","title":"Prettier Plugin for Twig","description":"Prettier plugin for formatting Twig templates, including .twig, .html.twig, and .melody.twig files. Version 1.0.1 is the current stable release. Integrates with the standard Prettier workflow but requires manual plugin configuration in some editors. Key differentiators: supports Melody component framework, offers Twig-specific options like twigSingleQuote, twigAlwaysBreakObjects, twigFollowOfficialCodingStandards, and twigMultiTags for custom tag pairs. Low maintenance activity on GitHub.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install prettier-plugin-twig"],"cli":null},"imports":["module.exports = require('prettier-plugin-twig-melody')","// In .prettierrc.json: add plugin path\n{ \"plugins\": [\"./node_modules/prettier-plugin-twig-melody\"] }","// In .prettierrc.json\n{ \"twigSingleQuote\": true, \"twigAlwaysBreakObjects\": false }"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// 1. Install dependencies\nnpm install --save-dev prettier prettier-plugin-twig-melody\n\n// 2. Create .prettierrc.json with plugin and options\n// {\n//   \"printWidth\": 80,\n//   \"tabWidth\": 4,\n//   \"singleQuote\": true,\n//   \"plugins\": [\"./node_modules/prettier-plugin-twig-melody\"],\n//   \"twigSingleQuote\": true,\n//   \"twigAlwaysBreakObjects\": false\n// }\n\n// 3. Format all .melody.twig files\nnpx prettier --write \"**/*.melody.twig\"\n\n// 4. Example Twig input (before formatting):\n// {% block content %}<div class='foo'>{{ text }}</div>{% endblock %}\n\n// 5. After formatting:\n// {% block content %}\n//     <div class=\"{{ 'foo' }}\">{{ text }}</div>\n// {% endblock %}","lang":"javascript","description":"Installs the plugin, adds configuration to .prettierrc.json, and runs Prettier on .melody.twig files showing before/after formatting.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}