diff --git a/.gitignore b/.gitignore
index 29f916f0d..9a95231c7 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 5ba9101f2..03333fb82 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 0ce4b85b4..abf2da12c 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 72434892d..f4ba108ab 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 000000000..89f3a0d19
--- /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 000000000..4eec75e85
--- /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 f24a039e9..0e41db570 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 %>