From a765cefe5f2b283306823b912821ff643820200f Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Mon, 9 Oct 2017 03:28:54 -0400 Subject: [PATCH] Move css to subdirectory in prep for page-specific css --- style.css => css/playfield.css | 0 html/editor.html | 2 +- html/playfield.html | 2 +- server.js | 14 +++++++++----- 4 files changed, 11 insertions(+), 7 deletions(-) rename style.css => css/playfield.css (100%) diff --git a/style.css b/css/playfield.css similarity index 100% rename from style.css rename to css/playfield.css diff --git a/html/editor.html b/html/editor.html index ec20553..e66cb0e 100644 --- a/html/editor.html +++ b/html/editor.html @@ -1,7 +1,7 @@ - + Editor diff --git a/html/playfield.html b/html/playfield.html index d4055fc..b5117f3 100644 --- a/html/playfield.html +++ b/html/playfield.html @@ -2,7 +2,7 @@ - + Playfield diff --git a/server.js b/server.js index fd80d15..832db7b 100644 --- a/server.js +++ b/server.js @@ -20,8 +20,15 @@ const server = http.createServer((req, res) => { case 'index.html': sendIndex(res); break; - case 'style.css': - sendFile(res, 'style.css', 'text/css'); + case 'css': + switch (pathParts[2]) { + case 'playfield.css': + case 'editor.css': + sendFile(res, 'css/' + pathParts[2], 'text/css'); + break; + default: + send404(res, uri); + } break; case 'js': switch (pathParts[2]) { @@ -105,7 +112,6 @@ function sendIndex(res) { const html = ` - Index @@ -122,7 +128,6 @@ function sendDeckIndex(res, deckName) { const html = ` - ${deckName} @@ -214,7 +219,6 @@ function send404(res, uri) { const html = ` 404 Not Found -

Error 404: Path ${uri.pathname} not found