← back to Dw Fleet Registry
dw-header: hide ANY pre-existing <header> + propagate to fleet; verified 11 sites render new header public-mode
af278f458bffb62580e89373d31d08ef75ce453d · 2026-06-01 15:48:36 -0700 · Steve Abrams
Files touched
M component/dw-header.jsA propagate-component.mjs
Diff
commit af278f458bffb62580e89373d31d08ef75ce453d
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Mon Jun 1 15:48:36 2026 -0700
dw-header: hide ANY pre-existing <header> + propagate to fleet; verified 11 sites render new header public-mode
---
component/dw-header.js | 9 +++++----
propagate-component.mjs | 25 +++++++++++++++++++++++++
2 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/component/dw-header.js b/component/dw-header.js
index 0f10a0b..d02a7b6 100644
--- a/component/dw-header.js
+++ b/component/dw-header.js
@@ -98,12 +98,13 @@
'<nav class="dwh-drawer" id="dwhNavDrawer" aria-label="Primary">' + linksHTML(NAV) + '</nav>' +
(isAdmin ? '<nav class="dwh-drawer dwh-admin-drawer" id="dwhAdminDrawer" aria-label="Admin tools"><div class="dwh-head">Admin tools</div>' + linksHTML(ADMIN) + '<button type="button" data-act="logout">Sign out admin</button></nav>' : '');
- // remove any pre-existing inline header so we don't double up
- var old = document.querySelector('header.ns-header, header.dwh:not(:first-of-type)');
- if (old && old.className.indexOf('dwh') === -1) old.style.display = 'none';
-
document.body.insertBefore(header, document.body.firstChild);
+ // hide ANY pre-existing site header (ns-header, .header, etc.) so we never double up
+ document.querySelectorAll('header').forEach(function (h) {
+ if (h !== header && h.className.indexOf('dwh') === -1) h.style.display = 'none';
+ });
+
// ---- behaviour ----
function drawer(id) { return document.getElementById(id); }
function close(navId, btnId) { var d = drawer(navId), b = document.getElementById(btnId); if (d) d.classList.remove('open'); if (b) b.setAttribute('aria-expanded', 'false'); }
diff --git a/propagate-component.mjs b/propagate-component.mjs
new file mode 100644
index 0000000..3ef4c94
--- /dev/null
+++ b/propagate-component.mjs
@@ -0,0 +1,25 @@
+import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path';
+import { execSync } from 'node:child_process';
+const PROJECTS = path.join(os.homedir(),'Projects');
+const SELF = '/Users/stevestudio2/Projects/dw-fleet-registry';
+const comp = fs.readFileSync(path.join(SELF,'component','dw-header.js'),'utf8');
+const targets = fs.readFileSync('/tmp/fleet-targets.txt','utf8').split('\n').filter(Boolean);
+const sh=(c,d)=>{try{return execSync(c,{cwd:d,stdio:['ignore','pipe','pipe']}).toString().trim()}catch{return null}};
+const titleCase=s=>s.replace(/(wallcoverings?|wallpapers?|walls?|fabric|covering)/gi,' $1').replace(/\s+/g,' ').trim().replace(/\b\w/g,c=>c.toUpperCase());
+const nameFix={linenwallpaper:'Linen Wallpaper',silkwallpaper:'Silk Wallpaper'};
+let n=0;
+for(const slug of targets){
+ const dir=path.join(PROJECTS,slug); const pub=path.join(dir,'public','dw-header.js'); const idx=path.join(dir,'public','index.html');
+ if(!fs.existsSync(idx)) continue;
+ let changed=false;
+ // 1. propagate component
+ if(!fs.existsSync(pub) || fs.readFileSync(pub,'utf8')!==comp){ fs.writeFileSync(pub,comp); changed=true; }
+ // 2. fix lowercase name
+ if(nameFix[slug]){ let h=fs.readFileSync(idx,'utf8'); const nh=h.replace(/(window\.DwHeaderConfig=\{siteName:)("[^"]*"|'[^']*')/, `$1${JSON.stringify(nameFix[slug])}`); if(nh!==h){fs.writeFileSync(idx,nh);changed=true;} }
+ if(changed){
+ sh('git checkout -B style-rebuild-pilot',dir); sh('git add public/dw-header.js public/index.html',dir);
+ const c=sh(`git -c user.email="steve@designerwallcoverings.com" -c user.name="Steve Abrams" commit -q -m "dw-header: hide ANY pre-existing <header> (not just ns-header); title-case bare-slug names" && git rev-parse --short HEAD`,dir);
+ n++; if(nameFix[slug]||n<=3) console.log(' '+slug.padEnd(22)+(c||''));
+ }
+}
+console.log(`\n${n} sites updated (component + name fixes)`);
← 2cf8354 fix-header-inject: re-inject dw-header before real </body> (
·
back to Dw Fleet Registry
·
fleet viewer: proxy-side image resize via optional sharp (/i f1cf338 →