【问题标题】:Play 2.x Static assets not foundPlay 2.x 未找到静态资源
【发布时间】:2016-04-22 09:25:09
【问题描述】:

我不确定为什么我的公共资产没有被游戏发现。我正在使用与 play2 intelliJ 项目中的激活器模板相同的代码。

路线

# Map static resources from the /public folder to the /assets URL path
GET    /assets/*file       controllers.Assets.at(path="/public", file)

和html

<img src="@routes.Assets.at(s"images/foo.png")" width="64px">

似乎是正确的,并且 foo.png 位于 public/images 文件夹中。检查员在 html 中用“找不到”消息突出显示 images/foo.png。它们似乎正在被编译,因为它们也正确地放置在目标目录中。应用程序和 html 的其余部分工作正常

对此有什么可能的解释?

【问题讨论】:

    标签: intellij-idea playframework sbt typesafe-activator


    【解决方案1】:

    试试:

    @routes.Assets.versioned("images/foo.png")
    

    老实说,我不知道为什么,但我知道它对我有用。

    【讨论】:

      【解决方案2】:

      有趣的是,没有任何问题。似乎在 sbt、play 和 IntelliJ 之间,资源分辨率只是存在滞后。大约一个小时后,一切都突然起作用了。

      这可能无法重现,因此这个问题可能会被删除

      【讨论】:

        猜你喜欢
        • 2015-06-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-01-04
        • 1970-01-01
        相关资源
        最近更新 更多