Skip to main content

Module assets

Module assets 

Source
Expand description

Content-hashed static assets.

Hashing happens at build time, in generate, not when the server starts. At runtime this module only reads the manifest that build produced and applies the two cache-control policies: hashed URLs are immutable for a year, everything else is never cached.

Re-exports§

pub use generate::FAVICON_DIRECTORY;
pub use generate::FAVICON_PNG_SOURCE;
pub use generate::FAVICON_SVG_SOURCE;
pub use generate::Phase;
pub use generate::STATIC_DIRECTORY;
pub use generate::generate_static_assets;
pub use icons::DERIVED;
pub use icons::IconSource;
pub use icons::SOURCE_PNG_SIZE;
pub use icons::dimensions;
pub use icons::resolve_source;

Modules§

generate
The build-time static-asset pipeline.
icons
The icon set, rendered from the one icon a project authors.

Structs§

CacheBuster
Resolves a logical asset path to its content-hashed one.
Manifest
A logical-path to hashed-path map.

Enums§

CacheBusterError
Why the asset cache could not be built.

Constants§

MANIFEST_PATH
Where the JSON manifest is written, relative to the project root.
TYPESCRIPT_MODULE_PATH
Where the generated TypeScript module is written.

Functions§

content_modified
The newest modification time across everything that determines page output.
probe_social_image
Reads path’s dimensions and MIME type.
validate_declared
Checks that every declared asset is in the manifest.
validate_icons
Checks the icon set: one source, and every derived file present and exactly the size it claims to be.