Assets.at or Assets.versioned vs simple URL in views

Hi all.
What’s the point in using Assets.at or Assets.versioned in views instead of simple URL?

For example,
link href="@routes.Assets.at(“stylesheets/lib/bootstrap.min.css”)" rel=“stylesheet”
vs
link href="/assets/stylesheets/lib/bootstrap.min.css" rel=“stylesheet”

Second is better for html typesetting and concise.
I know just one benefit is minifying version files like jquery.js in production mode.

Hi @avgolubev,

Minifying and fingerprinting (when using versioned) are the most obvious reasons here. Play will transparently handler both for you in DEV and PROD mode. Also, if you decide to change your route from:

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

To (new path):

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

You won’t need to change your .scala.html files since the reverse router will handle that for you.

Best.

1 Like