简体   繁体   English

在Play Framework 2.5中的scala旋转模板中使用isProd和isDev

[英]Using isProd and isDev in scala twirl templates in Play Framework 2.5

I'm migrating an Play 2.4 application to 2.5 and now play.Play.application().isProd is deprecated. 我正在将Play 2.4应用程序迁移到2.5,现在play.Play.application().isProd已弃用。 I use this in various places in scala.html templates. 我在scala.html模板中的各个地方使用它。 (To decide weather or not to use minimized javascript.) (决定天气与否使用最小化的javascript。)

It seems unreasonable to pass this in as parameters into every template. 将其作为参数传递到每个模板似乎是不合理的。

Is there a way to inject the Application into the template directly? 有没有办法直接将Application注入模板?

我在2.4中使用了相同的方法,在2.5中我切换到了play.Environment.simple().isProd

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM