sbt-web plugin for adding checksum files for web assets. Checksums are useful for asset fingerprinting and etag values.
The plugin works by prepending a digest to the asset name. The default digest algorithm used is MD5. In addition an .md5 file (depending on the algorithm) is also generated containing the hash. The hash can then be used to lookup the associated hashed file.
You may have an asset such as:
sbt-digest will create a second copy of the file with the hash and a digest file:
Add the plugin to
project/plugins.sbt. For example:
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.3")
Your project's build file also needs to enable sbt-web plugins. For example with build.sbt:
lazy val root = (project in file(".")).enablePlugins(SbtWeb)
As with all sbt-web asset pipeline plugins you must declare their order of execution e.g.:
pipelineStages := Seq(digest)
Supported hash algorithms are
sha1. The default is to only create
md5 checksum files. To configure this, modify the
setting. For example, to also generate
sha1 checksum files:
DigestKeys.algorithms += "sha1"
Include and exclude filters can be provided. For example, to only create
checksum files for
includeFilter in digest := "*.js"
Or to exclude all
.js files but include any other files:
excludeFilter in digest := "*.js"
Contributions via GitHub pull requests are gladly accepted from their original author. Before we can accept pull requests, you will need to agree to the Typesafe Contributor License Agreement online, using your GitHub account.
This code is licensed under the Apache 2.0 License.