Skip to content

Fix privacy page stylesheet hash syncing - #149

Merged
alvin000009238 merged 1 commit into
devfrom
fix-css-for-privacy-policy-page-2026-04-07-02-03-54
Apr 7, 2026
Merged

Fix privacy page stylesheet hash syncing#149
alvin000009238 merged 1 commit into
devfrom
fix-css-for-privacy-policy-page-2026-04-07-02-03-54

Conversation

@alvin000009238

Copy link
Copy Markdown
Owner

Motivation

  • The privacy page CSS reference was hard-coded to an old hashed filename so its styles broke after new builds.
  • The build-time hash injector only updated public/index.html, leaving other static pages out of sync with Vite output.

Description

  • Update public/privacy.html to reference the current hashed stylesheet and add id="vite-css" so it can be targeted by the injector.
  • Extend scripts/inject-hash.js to iterate over an htmlPaths array and update both public/index.html and public/privacy.html with the hashed JS/CSS filenames from the Vite manifest.
  • Preserve the existing manifest parsing and regex replacement logic and add per-file log output when each HTML file is updated.

Testing

  • Ran npm test (node --test tests/frontend/*.test.js) and all frontend tests passed with 15 tests and 0 failures.
  • The injector script was exercised locally by running the build-step replacement flow (manifest-driven replacements) and successfully wrote updated HTML files as logged by the script.

Codex Task

Copilot AI review requested due to automatic review settings April 7, 2026 02:04
@alvin000009238
alvin000009238 merged commit f93682b into dev Apr 7, 2026
3 checks passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the inject-hash.js script to support multiple HTML files by iterating over an array of paths, including both index.html and privacy.html. It also adds an existence check for these files and updates the CSS link in privacy.html with a new hash and an ID. I have no feedback to provide.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes broken styling on the static privacy page by ensuring its Vite-hashed asset references stay in sync with build output, extending the existing build-time hash injection step beyond public/index.html.

Changes:

  • Updated public/privacy.html to use the current hashed CSS filename and added id="vite-css" so it can be reliably replaced by the injector.
  • Extended scripts/inject-hash.js to update multiple HTML targets (index.html and privacy.html) using the Vite manifest, with per-file success logging.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
scripts/inject-hash.js Applies manifest-driven JS/CSS filename replacement across multiple static HTML files.
public/privacy.html Adds the vite-css link marker and updates the CSS href so the injector can keep it current.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/inject-hash.js
// Iterate over manifest keys to find entry points and inject their new names
Object.keys(manifest).forEach(key => {
htmlPaths.forEach(htmlPath => {
if (!fs.existsSync(htmlPath)) {

Copilot AI Apr 7, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

htmlPaths includes files that are intended to be kept in sync, but missing files are currently skipped silently (return without any log). This can hide a path typo or unexpected missing file and lead to shipping an out-of-date HTML page. Consider logging a warning (or failing the script) when a configured HTML target is not found.

Suggested change
if (!fs.existsSync(htmlPath)) {
if (!fs.existsSync(htmlPath)) {
console.warn(`[Hash Injector] Configured HTML target not found: ${path.relative(projectRoot, htmlPath)}`);

Copilot uses AI. Check for mistakes.
Comment thread scripts/inject-hash.js
Comment on lines +32 to 35
Object.keys(manifest).forEach(key => {
const entryData = manifest[key];
if (entryData && (entryData.isEntry || entryData.isDynamicEntry) && entryData.file) {
// chunk name could be 'main.js' or 'frontend/main.js'

Copilot AI Apr 7, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation inside the nested Object.keys(manifest).forEach(...) block is inconsistent (the inner block contents are not indented relative to the callback). Please re-indent this section to match the rest of the file to keep it readable and reduce the chance of future editing mistakes.

Copilot uses AI. Check for mistakes.
@alvin000009238
alvin000009238 deleted the fix-css-for-privacy-policy-page-2026-04-07-02-03-54 branch May 13, 2026 12:39
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.

2 participants