Skip to content

Add asset versioning, dynamic static base and centralized template rendering#2

Open
dissenter-web wants to merge 9 commits into
mainfrom
codex/fix-styles-issues-after-deployment-1zexek
Open

Add asset versioning, dynamic static base and centralized template rendering#2
dissenter-web wants to merge 9 commits into
mainfrom
codex/fix-styles-issues-after-deployment-1zexek

Conversation

@dissenter-web

Copy link
Copy Markdown
Owner

Motivation

  • Introduce cache-busting and flexible static asset paths so updated assets are reliably loaded across deployments.
  • Reduce duplication when rendering templates by centralizing common context like asset_version and request.
  • Use url_for for static asset URLs in templates to ensure correct URL construction.

Description

  • Add ASSET_VERSION environment variable and expose it to templates via a new render_template helper that injects asset_version into every response in app/main.py.
  • Replace direct templates.TemplateResponse(...) calls with render_template(...) across route handlers.
  • Add data attributes data-static-base and data-asset-version to the root HTML element in templates/base.html and include ?v={{ asset_version }} query params on CSS/JS static includes.
  • Update client JS (static/js/layout.js, static/js/project.js, static/js/theme.js) to compute a dynamic staticBase from the page attribute and append the assetVersion to fetch and CSS links for cache-busting; update theme link generation to include both assetVersion and a timestamp.
  • Replace hard-coded /static/... image/script paths in templates with url_for('static', path=...) calls and add versioning to script tags; add logo path update in header and project script include.

Testing

  • Ran the project test suite with pytest and all tests passed.
  • Ran flake8 linting checks and no new issues were reported.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant