scalate / sbt-scalate-precompiler

:open_file_folder: Scalate Templates Precompiler
http://scalate.github.io/scalate/
MIT License
10 stars 4 forks source link

Precompile scalate templates in SBT multi module project (unit tests) #3

Open Fruzenshtein opened 7 years ago

Fruzenshtein commented 7 years ago

Hello, I've read the brief usage guide for sbt-scalate-precmpiler, but looks like there no answer on my questions. Is it possible to use the plugin in order to precompile templates before running unit tests? I use SBT for dependency and build management of the multi module project. I tried to apply the plugin to the module which implements email functionality, but it does not work as expected.

So what I did?

  1. Add addSbtPlugin("org.scalatra.scalate" % "sbt-scalate-precompiler" % "1.8.0.1") to the plugins.sbt

  2. Add following setting to the email module:

lazy val email = project.in(file("email"))
  .settings(name := "email")
  .settings(Common.settings)
  .settings(libraryDependencies ++= Dependencies.emailDependencies ++ Dependencies.testDependencies)
  .enablePlugins(JavaAppPackaging)
  .settings(
    scalateTemplateConfig in Compile <<= (sourceDirectory in Compile) { base =>
      Seq(
        TemplateConfig(
          base / "resources" / "templates", // I store mustache templates under 
          email/src/main/resources/tempaltes
          Nil,
          Nil)
      )
   }
  )

When I run a unit test which involves email module, I still see that the templates compile in runtime.

What should I do in order to force the plugin work as expected?

Thanks