https://github.com/sgruendel/prettier-plugin-jte
Prettier plugin for jte template files.
https://github.com/sgruendel/prettier-plugin-jte
html jte prettier prettier-plugin
Last synced: 26 days ago
JSON representation
Prettier plugin for jte template files.
- Host: GitHub
- URL: https://github.com/sgruendel/prettier-plugin-jte
- Owner: sgruendel
- License: mit
- Created: 2026-03-28T12:24:14.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-03-28T15:58:29.000Z (about 1 month ago)
- Last Synced: 2026-03-28T17:44:11.744Z (about 1 month ago)
- Topics: html, jte, prettier, prettier-plugin
- Language: TypeScript
- Homepage:
- Size: 38.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# prettier-plugin-jte
[](https://github.com/sgruendel/prettier-plugin-jte/actions/workflows/ci.yml)
[](https://depfu.com/github/sgruendel/prettier-plugin-jte?project_id=70595)
[](https://www.npmjs.com/package/prettier-plugin-jte)
Prettier plugin for formatting Java JTE templates with Prettier.
This plugin targets Java-style `.jte` files and formats JTE directives while delegating HTML layout to Prettier's HTML printer.
It supports:
- `${...}` and `$unsafe{...}` expressions
- `@if`, `@elseif`, `@else`, `@endif`
- `@for`, `@else`, `@endfor`
- `@import` and `@param`
- `@template...(...)` calls
- `!{...}` local Java code blocks
- ``@`...` `` content blocks
- `<%-- ... --%>` comments
It currently focuses on Java JTE syntax only. Kotlin `.kte` syntax is out of scope.
## Install
```bash
npm install --save-dev prettier prettier-plugin-jte
```
## Usage
Prettier will pick up the plugin automatically when it is installed locally and the file extension is `.jte`.
You can also invoke it explicitly:
```bash
npx prettier --write "src/**/*.jte" --parser jte
```
Example `.prettierrc`:
```json
{
"plugins": ["prettier-plugin-jte"]
}
```
## Example
```jte
@import org.example.Page
@param Page page
@if(page.getDescription() != null)
@endif
@template.layout.page(
page = page,
content = @`
${page.getTitle()}
`
)
```