Plombir::Assets::Rewrite
Constants
Quoted src/href, either quote style, attribute name in any
case. Group 1 is src=" (prefix), 2 the quote, 3 the URL.
URL prefix this pass owns, and the output directory fingerprinted
files live under (dist/assets/…). public/ mirrors the output
root, so /assets/x is backed by public/assets/x.
Class methods
Resolves one asset path to its public URL through manifest:
a hit returns the fingerprinted URL, a miss the unfingerprinted
/assets/… form (backed by public/, or reported missing by
the rewrite pass). The | asset_url filter delegates here so
both spellings share one rule.
Rewrite.asset_url("style.css", {"style.css" => "assets/style.a1b2c3d4.css"})
# => "/assets/style.a1b2c3d4.css"
Rewrite.asset_url("logo.png", {} of String => String)
# => "/assets/logo.png"
Rewrites quoted src/href attributes in html through
manifest (source-relative under assets/ → output-relative
under dist/). public_dir backs the existence check for
non-fingerprinted files.
Rewrite.rewrite(%(<img src="/assets/a.png">), {"a.png" => "assets/a.12345678.png"}, "public")