Skip to content

Theme static files not updated when using build cache #341

@mmcky

Description

@mmcky

Problem

When using a build cache (e.g., caching the _build folder between CI runs), the theme's static files (quantecon-book-theme.js and quantecon-book-theme.css) are not regenerated even when the theme package is updated.

This causes new theme features (like git metadata headers, collapsible stderr warnings, etc.) to not appear in builds that use a cached _build folder.

Root Cause

The cached _build/html/_static/ folder contains:

  • scripts/quantecon-book-theme.js
  • styles/quantecon-book-theme.css

When Sphinx/Jupyter Book runs with an existing _build folder, it doesn't regenerate these static files if they already exist, even if a newer version of the theme is installed.

Affected Repositories

This affects all lecture repositories that use build caching:

  • lecture-jax
  • lecture-python.myst
  • lecture-python-programming.myst

Possible Solutions

  1. Version or hash the static filenames - Include version number or content hash in the filename (e.g., quantecon-book-theme-0.13.2.js or quantecon-book-theme.abc123.js)

  2. Add cache-busting query parameters - Append version to URL (e.g., quantecon-book-theme.js?v=0.13.2)

  3. Force regeneration in theme - Have the theme check its version against cached files and regenerate if needed

Current Workaround

Rebuild the cache from scratch after theme updates, or manually delete the cached theme static files before building.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions