I'm working on a spring boot application and adding a small configuration web page using Mustache templates using this article as an example. I have it working fine when all of my mustache template files have the extension .html, but the problem is that I don't get any IDE support. IntelliJ IDEA has a plugin for mustache, but the extension has to be .mustache. When I change the file extensions, though, I end up with a 404 error.
I've seen in the official example that they are using .mustache, so I know it's possible. I couldn't find anything in that project to indicate that a setting was changed to enable this. The only major difference is that I am using Kotlin instead of Java, but I don't see why that would have any effect on the mustache file extensions.
What am I missing? Thanks!
According to Spring Boot documentation (for v1.5.6, for v2.0.0.M3) you can easily configure the extension of Mustache template files by setting the following property:
spring.mustache.suffix=.mustache # Suffix to apply to template names.
In v1.5.x the default was .html
but in v2.0.0 they switched to .mustache
. (release notes)
Also you can configure IntelliJ IDEA to handle *.html
files with the Handlebars/Mustache plugin by registering *.html
pattern in Settings > Editor > File types > Handlebars/Mustache.