or Assets.versioned vs simple URL in views

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

For example,
link href="“stylesheets/lib/bootstrap.min.css”)" rel=“stylesheet”
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.


1 Like