How to set up asset fingerprinting in Play 2.3.4?

萝らか妹 提交于 2019-12-03 11:16:28
Marius Soutier

First off, you should update to sbt 0.13.5, because sbt-web and its plugins use an sbt feature called "auto-plugins" that was introduced in 0.13.5.

The asset pipeline is by the way not triggered in development mode, you have to test via sbt start (or sbt dist but that takes more time).

The versioned method just checks if an asset has a companion with the .md5 suffix. You should check if these files exist in target/web.

tfh

As far as I can remember I had the same problem a couple of weeks ago. Change the asset route to:

GET   /web/assets/*file   controllers.Assets.versioned(path="/public", file:Asset)

(See the "file:Asset" - it seems that "Asset" is required if I remember correctly)

If the rjs task of the pipeline encounters some problem, then the digest task may not work properly. For instance, this happens when the default main entry point for rjs is not found:

Error: Error: .../target/web/rjs/appdir/javascripts/main.js does not exist.

In this particular case, setting the sbt key RjsKeys.mainModule to the right value solves the problem and *.js files are properly fingerprinted.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!