Skip to content

Enable HTTP headers to allow browser caching of assets (Meta Issue) #839

@sabine

Description

@sabine

Problems with caching of assets (CSS, JavaScript, Fonts) are mentioned in these issues:

Underlying problem: We cannot currently enable asset caching via HTTP headers because assets are being served under their exact filenames.

What needs to be done: serve assets under filenames that include a hash (file content or last modified time). This enables us to allow caching via HTTP headers indiscriminately while still maintaining the ability to make changes that will reach our users.

Idea: use a PPX that, at compile time hashes the file content (or inspects the last-modified time) and copies the file accordingly, then returns the path of the hash-named file. Then, we can use, e.g. [%asset "css/main.css" ] in our templates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    performance-optimisationImprovements to the performance of ocaml.org (speed / size / other)

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions