Move css to subdirectory in prep for page-specific css

This commit is contained in:
Adam Goldsmith 2017-10-09 03:28:54 -04:00
parent 29b3b70738
commit a765cefe5f
4 changed files with 11 additions and 7 deletions

View File

@ -1,7 +1,7 @@
<html>
<head>
<script src="/js/editor.js"></script>
<link rel="stylesheet" type="text/css" href="/style.css">
<link rel="stylesheet" type="text/css" href="/css/editor.css">
<title>Editor</title>
</head>
<body>

View File

@ -2,7 +2,7 @@
<head>
<script src="/js/interact.js"></script>
<script src="/js/playfield.js"></script>
<link rel="stylesheet" type="text/css" href="/style.css">
<link rel="stylesheet" type="text/css" href="/css/playfield.css">
<title>Playfield</title>
</head>
<body>

View File

@ -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 = `
<html>
<head>
<link rel="stylesheet" type="text/css" href="/style.css">
<title>Index</title>
</head>
<body>
@ -122,7 +128,6 @@ function sendDeckIndex(res, deckName) {
const html = `
<html>
<head>
<link rel="stylesheet" type="text/css" href="/style.css">
<title>${deckName}</title>
</head>
<body>
@ -214,7 +219,6 @@ function send404(res, uri) {
const html = `
<head>
<title>404 Not Found</title>
<link rel="stylesheet" href="/style.css">
</head>
<body>
<h1>Error 404: Path ${uri.pathname} not found</h1>