← back to Designer Wallcoverings
Serve DW style guide standalone via pm2 (dw-style-guide, :9972)
008e67ab8a76cbfcf9e1b0907d4b933ea6cd34eb · 2026-06-23 16:33:34 -0700 · Steve
Zero-dependency static server for style-guide/ — no auth, no framework,
no brand-router dependency. Always-on local URL for the token reference.
Files touched
Diff
commit 008e67ab8a76cbfcf9e1b0907d4b933ea6cd34eb
Author: Steve <steve@designerwallcoverings.com>
Date: Tue Jun 23 16:33:34 2026 -0700
Serve DW style guide standalone via pm2 (dw-style-guide, :9972)
Zero-dependency static server for style-guide/ — no auth, no framework,
no brand-router dependency. Always-on local URL for the token reference.
---
style-guide/serve.js | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/style-guide/serve.js b/style-guide/serve.js
new file mode 100644
index 00000000..6ecd133f
--- /dev/null
+++ b/style-guide/serve.js
@@ -0,0 +1,35 @@
+#!/usr/bin/env node
+/* Zero-dependency static server for the DW Style Guide.
+ Serves this directory (tokens.css + index.html) — no auth, no framework.
+ Run under pm2: pm2 start serve.js --name dw-style-guide */
+const http = require('http');
+const fs = require('fs');
+const path = require('path');
+
+const ROOT = __dirname;
+const PORT = process.env.PORT || 9972;
+const MIME = {
+ '.html': 'text/html; charset=utf-8',
+ '.css': 'text/css; charset=utf-8',
+ '.js': 'text/javascript; charset=utf-8',
+ '.png': 'image/png',
+ '.svg': 'image/svg+xml',
+ '.ico': 'image/x-icon',
+ '.json': 'application/json; charset=utf-8',
+};
+
+http.createServer((req, res) => {
+ // strip query, default to index.html, block path traversal
+ let rel = decodeURIComponent((req.url || '/').split('?')[0]);
+ if (rel === '/' || rel.endsWith('/')) rel += 'index.html';
+ const file = path.normalize(path.join(ROOT, rel));
+ if (!file.startsWith(ROOT)) { res.writeHead(403).end('Forbidden'); return; }
+
+ fs.readFile(file, (err, buf) => {
+ if (err) { res.writeHead(404, { 'Content-Type': 'text/plain' }).end('Not found'); return; }
+ res.writeHead(200, { 'Content-Type': MIME[path.extname(file)] || 'application/octet-stream' });
+ res.end(buf);
+ });
+}).listen(PORT, '127.0.0.1', () => {
+ console.log(`DW Style Guide → http://127.0.0.1:${PORT}/`);
+});
← 2744dd36 Add DW design-language style guide: tokens.css + servable /s
·
back to Designer Wallcoverings
·
Collection theme consolidated push LIVE (Steve-approved): 5 a603726e →