Play Framework @routes.Assets.at Compilation Error

Alright, to sum up the solution: Play lets you serve your assets in two different ways. The old fashioned and the new fingerprinted method introduced with sbt-web. In either case make sure you use right call in your view files:

Fingerprinted assets

This is the recommended way to serve assets in play. Fingerprinted assets make use of an aggressive caching strategy. You can read more about this topic here: https://playframework.com/documentation/2.4.x/Assets

routes config:

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

Make sure the type of file is indicated as Asset

call in views:

@routes.Assets.versioned("an_asset")

Old fashioned assets

This is basically the method used before the introduction of sbt-web.

routes config:

GET     /assets/*file               controllers.Assets.at(path="/public", file)

call in views:

@routes.Assets.at("an_asset")

Leave a Comment