ソースを参照

Add cssmerger so that I can modularize the css.

Lee Morgan 5 年 前
コミット
d9ffe84979
5 ファイル変更5404 行追加7 行削除
  1. 2 1
      .gitignore
  2. 7 0
      app.js
  3. 5391 1
      package-lock.json
  4. 3 2
      package.json
  5. 1 3
      views/dashboardPage/dashboard.ejs

+ 2 - 1
.gitignore

@@ -1,3 +1,4 @@
 node_modules/
 dist/
-bundle.js
+bundle.js
+bundle.css

+ 7 - 0
app.js

@@ -4,6 +4,7 @@ const mongoose = require("mongoose");
 const compression = require("compression");
 const https = require("https");
 const fs = require("fs");
+const cssmerger = require("cssmerger");
 
 const app = express();
 
@@ -49,6 +50,12 @@ app.use(express.json());
 app.use(session(sessionOptions));
 require("./routes")(app);
 
+cssmerger([
+    "./views/shared/shared.css",
+    "./views/dashboardPage/dashboard.css",
+    "./views/dashboardPage/sidebars.css"
+], "./views/dashboardPage/bundle.css");
+
 if(process.env.NODE_ENV === "production"){
     httpsServer.listen(process.env.HTTPS_PORT, ()=>{});
 }

ファイルの差分が大きいため隠しています
+ 5391 - 1
package-lock.json


+ 3 - 2
package.json

@@ -25,10 +25,11 @@
     "bcryptjs": "^2.4.3",
     "compression": "^1.7.4",
     "cookie-session": "^1.4.0",
+    "cssmerger": "^1.0.1",
     "ejs": "^2.7.4",
     "express": "^4.17.1",
-    "mailgun-js": "^0.22.0",
-    "mongoose": "^5.9.26",
+    "mailgun-js": "^0.6.7",
+    "mongoose": "^5.12.4",
     "multer": "^1.4.2",
     "xlsx": "^0.16.8"
   },

+ 1 - 3
views/dashboardPage/dashboard.ejs

@@ -5,9 +5,7 @@
         <meta content="width=device-width, initial-scale=1" name="viewport"/>
         <title>The Subline</title>
         <link rel="icon" type="img/png" href="/shared/images/logo.png">
-        <link rel="stylesheet" href="/shared/shared.css">
-        <link rel="stylesheet" href="/dashboardPage/dashboard.css">
-        <link rel="stylesheet" href="/dashboardPage/sidebars.css">
+        <link rel="stylesheet" href="/dashboardPage/bundle.css">
         <link href="https://fonts.googleapis.com/css?family=Saira&display=swap" rel="stylesheet"> 
         <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
     </head>

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません