Search code examples
scalasbttwirl

Preprocessing of sbt-twirl templates


I need to preprocess some Twirl templates in my sbt project. Is it possible to define a task in build.sbt that will run before Twirl plugin compiles its templates?


Solution

  • sbt-web allows the sequencing of the asset pipeline through pipelineStages:

    pipelineStages := Seq(myPreProcessorTask, myTwirlTask)
    

    Documentation: Writing an Asset Pipeline task

    Source on GitHub.