From 2dd4f21c27c0ca29ab69284590107e3d19ae129d Mon Sep 17 00:00:00 2001
From: budparr <budparr@gmail.com>
Date: Mon, 09 Apr 2018 16:09:48 +0000
Subject: [PATCH] Update header/scripts to accommodate hashed assets

---
 layouts/_default/baseof.html       |    8 +++++++-
 src/webpack.config.js              |    4 ++--
 layouts/partials/site-scripts.html |    7 ++++++-
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index cf7f6eb..0aa5018 100755
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -17,7 +17,13 @@
       <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
     {{ end }}
 
-    <link href='{{ "dist/main.css" | absURL }}' rel='stylesheet' type="text/css" />
+    {{ $css_path := $.Param "dev.css_path" | default "themes/gohugo-theme-ananke/static/dist/css" }}
+    {{ with $css_path }}
+      {{ range readDir . }}
+        <link href='/dist/css/{{ .Name }}' rel='stylesheet' type="text/css" data-turbolinks-track="reload" />
+      {{ end }}
+    {{ end }}
+
     {{ block "favicon" . }}
       {{ partial "site-favicon.html" . }}
     {{ end }}
diff --git a/layouts/partials/site-scripts.html b/layouts/partials/site-scripts.html
index 2b34d1f..7508f27 100644
--- a/layouts/partials/site-scripts.html
+++ b/layouts/partials/site-scripts.html
@@ -1 +1,6 @@
-<script src="{{ "dist/app.bundle.js" | absURL }}" async></script>
+{{ $css_path := $.Param "dev.js_path" | default "themes/gohugo-theme-ananke/static/dist/js" }}
+{{ with $css_path }}
+  {{ range readDir . }}
+    <link href='/dist/js/{{ .Name }}' rel='stylesheet' type="text/css" data-turbolinks-track="reload" />
+  {{ end }}
+{{ end }}
diff --git a/src/webpack.config.js b/src/webpack.config.js
index f0af7ae..04da73f 100644
--- a/src/webpack.config.js
+++ b/src/webpack.config.js
@@ -30,7 +30,7 @@
 
 	output: {
 		path: path.join(__dirname, './../static/dist'),
-		filename: '[name].[chunkhash].js'
+		filename: 'js/[name].[chunkhash].js'
 	},
 
 	resolve: {
@@ -40,7 +40,7 @@
 	plugins: [
 		new ExtractTextPlugin({
 			filename: getPath => {
-				return getPath('[name].[contenthash].css');
+				return getPath('css/[name].[contenthash].css');
 			},
 			allChunks: true
 		})

--
Gitblit v1.10.0