Parser-backed CSS asset URL rewriting for production builds.
Uses Vize/LightningCSS to collect parser-backed URL ranges, then patches the original source without round-tripping through the serialized CSS AST.
Summary
Functions
Rebase relative asset URLs before an imported stylesheet loses its source location.
Rewrite relative CSS asset URLs to hashed output URLs.
Rewrite relative CSS asset URLs to dev-server URLs without copying files.
Rewrite relative CSS asset URLs and return emitted asset filenames.
Types
@type rewrite_assets_result() :: {:ok, %{code: String.t(), assets: [Volt.Builder.Asset.t()]}} | {:error, term()}
Functions
Rebase relative asset URLs before an imported stylesheet loses its source location.
@spec rewrite(String.t(), String.t() | nil, String.t(), keyword()) :: rewrite_result()
Rewrite relative CSS asset URLs to hashed output URLs.
Rewrite relative CSS asset URLs to dev-server URLs without copying files.
@spec rewrite_with_assets(String.t(), String.t() | nil, String.t(), keyword()) :: rewrite_assets_result()
Rewrite relative CSS asset URLs and return emitted asset filenames.