如何修改 play 2.3 项目的构建配置以包含由某些任务动态生成的资产?
目标是实现与app/assets
文件夹中当前包含的资产类似的东西:从某个地方获取一个文件,以某种方式对其进行转换(通常是编译它)并使其作为 /public 目录下的资产可用。我已经尝试向compile
任务添加依赖项:
compile in Compile <<= (compile in Compile) dependsOn Def.task {
val file = //generate file
IO.copyFile(file, baseDirectory.value / "public" / "foo.bar")
}
尽管此解决方案有效,但它会在编译期间复制文件,从而通知播放更改并因此安排新的编译,即在每次 http 请求时重新加载应用程序!
有没有其他方法可以添加新的动态资产而不会陷入恶性的重新加载循环?