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 63e82b4556
commit b0207e3f8b
4 changed files with 11 additions and 7 deletions

View File

@ -1,7 +1,7 @@
<html> <html>
<head> <head>
<script src="/js/editor.js"></script> <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> <title>Editor</title>
</head> </head>
<body> <body>

View File

@ -2,7 +2,7 @@
<head> <head>
<script src="/js/interact.js"></script> <script src="/js/interact.js"></script>
<script src="/js/playfield.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> <title>Playfield</title>
</head> </head>
<body> <body>

View File

@ -20,8 +20,15 @@ const server = http.createServer((req, res) => {
case 'index.html': case 'index.html':
sendIndex(res); sendIndex(res);
break; break;
case 'style.css': case 'css':
sendFile(res, 'style.css', 'text/css'); switch (pathParts[2]) {
case 'playfield.css':
case 'editor.css':
sendFile(res, 'css/' + pathParts[2], 'text/css');
break;
default:
send404(res, uri);
}
break; break;
case 'js': case 'js':
switch (pathParts[2]) { switch (pathParts[2]) {
@ -105,7 +112,6 @@ function sendIndex(res) {
const html = ` const html = `
<html> <html>
<head> <head>
<link rel="stylesheet" type="text/css" href="/style.css">
<title>Index</title> <title>Index</title>
</head> </head>
<body> <body>
@ -122,7 +128,6 @@ function sendDeckIndex(res, deckName) {
const html = ` const html = `
<html> <html>
<head> <head>
<link rel="stylesheet" type="text/css" href="/style.css">
<title>${deckName}</title> <title>${deckName}</title>
</head> </head>
<body> <body>
@ -214,7 +219,6 @@ function send404(res, uri) {
const html = ` const html = `
<head> <head>
<title>404 Not Found</title> <title>404 Not Found</title>
<link rel="stylesheet" href="/style.css">
</head> </head>
<body> <body>
<h1>Error 404: Path ${uri.pathname} not found</h1> <h1>Error 404: Path ${uri.pathname} not found</h1>