4 ms·
I've given my Go templates a double suffix like index.go.html and index.go.json. Most tools will recognize these as HTML and JSON files so highlighting works as
by rickette 2y ago
I've given my Go templates a double suffix like index.go.html and index.go.json. Most tools will recognize these as HTML and JSON files so highlighting works as expected. Additionally in JetBrains IDEs you can assign the "GoTemplate" language to .go.html and .go.json files and it will also recognize the template/html and template/text syntax. So this gives you full syntax highlighting of both HTML/JSON and Go templates.
See https://github.com/PDOK/gokoala?tab=readme-ov-file#intellij--goland https://github.com/PDOK/gokoala?tab=readme-ov-file#intellij-... for a script to set this up.