【问题标题】:webjars-play: How to use WebJarsUtil in Play 2.7webjars-play:如何在 Play 2.7 中使用 WebJarsUtil
【发布时间】:2019-01-02 16:07:47
【问题描述】:

迁移到 Play 2.7.0-RC3 后,我得到以下编译异常:

value css is not a member of org.webjars.play.WebJarsUtil

我在 Twirl-Template 中使用它,例如:

// inject
@this(webJarsUtil: org.webjars.play.WebJarsUtil)
...
@Html(webJarsUtil.css("dataTables.semanticui.min.css"))
...

如何在 Play 2.7 中使用它?

【问题讨论】:

    标签: scala playframework webjars twirl


    【解决方案1】:

    查看Unit test后,我想通了:

    // inject
    @this(webJarsUtil: org.webjars.play.WebJarsUtil)
    ...
    @webJarsUtil.locate("dataTables.semanticui.min.css").css()
    ...
    

    这也适用于脚本:

    @webJarsUtil.locate("jquery.dataTables.min.js").script()
    

    【讨论】:

      猜你喜欢
      • 2023-03-26
      • 1970-01-01
      • 1970-01-01
      • 2014-10-27
      • 2023-03-12
      • 2023-03-09
      • 1970-01-01
      • 2020-01-12
      • 1970-01-01
      相关资源
      最近更新 更多