0

I am new to playframework. How Asset Fingerprinting works? There is no specific document explaining internal working of fingerprinting.

How it internally generates the digest code like ad3303949495939398433-main.css or adfadvffddfcddf352545464-file.txt?

Does it hashes the file content or file name? And what is use of Asset Fingerprint in Play framework?

Please help me in understanding this.

Thanks,

j-dexx
  • 10,286
  • 3
  • 23
  • 36
Jitendra
  • 1
  • 1

1 Answers1

2

It hashes the file contents: it wouldn't make sense to use the filename.

By default it should use md5, but it can be configured: https://github.com/playframework/playframework/blob/2.5.9/framework/src/play/src/main/scala/play/api/controllers/Assets.scala#L98

The idea behind this is that using that hash, you can be more agressive with the caching of that file (because if you change anything in it, the name will be different).

Play docs reference this link: http://guides.rubyonrails.org/asset_pipeline.html#what-is-fingerprinting-and-why-should-i-care-questionmark. Despite it being to a different framework, they explain the idea of assets versioning

Salem
  • 12,808
  • 4
  • 34
  • 54