Browse Source

Fixing styles and adding html comments and making it cooler

Herton 4 years ago
parent
commit
060cb9dcbe
5 changed files with 16 additions and 7 deletions
  1. 8 2
      public/index.html
  2. 1 1
      public/manifest.json
  3. BIN
      public/preview.jpg
  4. 6 4
      public/styles.css
  5. 1 0
      server.js

+ 8 - 2
public/index.html

@@ -4,19 +4,25 @@
     <meta charset="UTF-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>Basic single file HTML</title>
+    <title>Single page node server with no dependencies</title>
     <meta name="description" content="Simgle file page basic page">
+    <!-- Above the fold styles -->
+    <style>.wrapper {max-width:500px;margin:1rem auto;text-align:center;padding:0 1rem;}</style>
+    <!-- Non blocking styles -->
     <link rel="preload" href="styles.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
     <noscript><link rel="stylesheet" href="styles.css"></noscript>
+    <!-- Assync scripts -->
     <script type="text/javascript" src="scripts.js" async></script>
+    <!-- PWA stuff -->
     <link rel="manifest" href="manifest.json">
     <meta name="theme-color" content="white">
     <link rel="apple-touch-icon" href="apple-touch-icon.png">
 </head>
 <body>
     <div class="wrapper">
-        <img src="favicon-32x32.png" width="16" height="16" alt="icon"/>
+        <img src="apple-touch-icon.png" width="90" height="90" alt="icon"/>
         <h2>Simple Node Server For A Single Page App</h2>
+        <img src="preview.jpg" width="500" height="258" alt="preview"/>
     </div>
 </body>
 </html>

+ 1 - 1
public/manifest.json

@@ -20,7 +20,7 @@
       }
     ],
     "start_url": "/?source=pwa",
-    "background_color": "#3367D6",
+    "background_color": "#607d8b",
     "display": "standalone",
     "scope": "/",
     "prefer_related_applications": false,

BIN
public/preview.jpg


+ 6 - 4
public/styles.css

@@ -1,5 +1,7 @@
-.wrapper {
-    max-width: 300px;
-    margin: 1rem auto;
-    text-align: center;
+h2 {
+    color: #607d8b;
+}
+img {
+    max-width: 100%; 
+    height: auto;
 }

+ 1 - 0
server.js

@@ -30,6 +30,7 @@ const server = http.createServer((req, res) => {
     const mediaType = getType(path);
     if (! mediaType) res.writeHead(404).end('Not found');
     res.writeHead(200, {
+        'Cache-Control': 'max-age=31536000',
         'Content-Type': mediaType == 'html' ? 'text/html' : types[mediaType]
     });
     const filePath = mediaType == 'html' ? htmlFile : public + path;