Twirl standalone - automatically compiling templates on change with sbt-twirl

I’m using Twirl outside of Play, with sbt-twirl plugin.

Running compile will properly compile all the templates under src/main/twirl and then compile the code under src/main/scala.

However, when running ~compile it would not run when Twirl templates are changed (it runs only when scala source code changes).

Is there a way to get Twirl templates automatically compiled on change?

Which version of Twirl are you using? How is the project configured? I think this may be related to playframework/twirl#186 which was fixed in Twirl 1.4.0. Could you try with that version and confirm if it is working or not?


1 Like

I’m using the scalatra template (scalatra/scalatra.g8).
It uses sbt-twirl 1.3.13.
After changing the version to sbt-twirl 1.4.0 the reloading works properly now.