From 2cafe15e854b493d335652755b74674c7e2da4f6 Mon Sep 17 00:00:00 2001
From: Yukai Huang
Date: Wed, 12 Oct 2016 17:15:59 +0800
Subject: Enable production assets hash
---
.gitignore | 1 +
package.json | 3 ++
public/views/foot.ejs | 3 +-
public/views/head.ejs | 2 +-
public/views/includes/header.ejs | 3 ++
public/views/includes/scripts.ejs | 3 ++
public/views/index.ejs | 4 +--
public/views/pretty.ejs | 5 ++--
public/views/slide.ejs | 4 +--
webpack.production.js | 58 ++++++++++++++++++++++++++++++++++++++-
10 files changed, 75 insertions(+), 11 deletions(-)
create mode 100644 public/views/includes/header.ejs
create mode 100644 public/views/includes/scripts.ejs
diff --git a/.gitignore b/.gitignore
index 29f916f0..9a95231c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,3 +24,4 @@ public/js/config.js
# ignore webpack build
public/build
+public/views/build
diff --git a/package.json b/package.json
index 5ba9101f..03333fb8 100644
--- a/package.json
+++ b/package.json
@@ -122,13 +122,16 @@
"url": "https://github.com/hackmdio/hackmd.git"
},
"devDependencies": {
+ "babel-core": "^6.17.0",
"babel-loader": "^6.2.5",
"bower-webpack-plugin": "^0.1.9",
"css-loader": "^0.25.0",
+ "ejs-loader": "^0.3.0",
"exports-loader": "^0.6.3",
"expose-loader": "^0.7.1",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.9.0",
+ "html-webpack-plugin": "^2.22.0",
"imports-loader": "^0.6.5",
"json-loader": "^0.5.4",
"less": "^2.7.1",
diff --git a/public/views/foot.ejs b/public/views/foot.ejs
index 0ce4b85b..abf2da12 100644
--- a/public/views/foot.ejs
+++ b/public/views/foot.ejs
@@ -20,9 +20,8 @@
<% } %>
-
-
+<%- include build/index-scripts %>
diff --git a/public/views/head.ejs b/public/views/head.ejs
index 72434892..f4ba108a 100644
--- a/public/views/head.ejs
+++ b/public/views/head.ejs
@@ -36,7 +36,7 @@
-
+<%- include build/index-header %>
diff --git a/public/views/includes/header.ejs b/public/views/includes/header.ejs
new file mode 100644
index 00000000..89f3a0d1
--- /dev/null
+++ b/public/views/includes/header.ejs
@@ -0,0 +1,3 @@
+<% for (var css in htmlWebpackPlugin.files.css) { %>
+
+<% } %>
diff --git a/public/views/includes/scripts.ejs b/public/views/includes/scripts.ejs
new file mode 100644
index 00000000..4eec75e8
--- /dev/null
+++ b/public/views/includes/scripts.ejs
@@ -0,0 +1,3 @@
+<% for (var chunk in htmlWebpackPlugin.files.chunks) { %>
+
+<% } %>
diff --git a/public/views/index.ejs b/public/views/index.ejs
index f24a039e..0e41db57 100644
--- a/public/views/index.ejs
+++ b/public/views/index.ejs
@@ -27,6 +27,7 @@
+ <%- include build/cover-header %>
@@ -193,7 +194,6 @@
-
<% if(useCDN) { %>
@@ -205,7 +205,7 @@
<% } %>
-
+ <%- include build/cover-scripts %>