Function

hashed(_:)

func hashed(_ path: String) -> String

Returns a cache-busted file path by inserting a content hash into the filename.

Call this from any renderer to produce fingerprinted asset URLs:

link(rel: "stylesheet", href: hashed("/static/output.css"))
// → "/static/output-a1b2c3d4.css"

Mentioned In