VS Code extension for formatting Nette Latte templates.
Features
- HTML Formatting: Uses VS Code's native HTML formatter to format your Latte templates
- Latte Syntax Preservation: All Latte tags (
{if}, {foreach}, {block}, etc.) are preserved and properly indented
- Respects Your Settings: Uses your VS Code HTML formatting configuration
All standard Latte block tags are supported:
- Conditions:
{if}, {ifset}, {ifchanged}, {switch}
- Loops:
{foreach}, {for}, {while}, {first}, {last}, {sep}, {iterateWhile}
- Blocks:
{block}, {define}, {embed}, {snippet}, {capture}
- Forms:
{form}, {label}, {formContainer}
- Others:
{translator}, {translate}, {spaceless}, {try}, {cache}, {sandbox}
Installation
- Open VS Code
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for "Latte Formatter"
- Click Install
Usage
- Open a
.latte file
- Format the document:
- Windows/Linux: Ctrl+Shift+I
- Mac: Cmd+Shift+I
- Or right-click → "Format Document"
Add to your settings.json:
{
"editor.formatOnSave": true,
"[latte]": {
"editor.defaultFormatter": "zraly.latte-formatter"
}
}
Requirements
License
MIT
| |