Update header/scripts to accommodate hashed assets

This commit is contained in:
budparr 2018-04-09 12:08:59 -04:00
parent 75bde5d095
commit 2dd4f21c27
No known key found for this signature in database
GPG Key ID: 05AB7813F9C39728
3 changed files with 15 additions and 4 deletions

View File

@ -17,7 +17,13 @@
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"> <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
{{ end }} {{ 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" . }} {{ block "favicon" . }}
{{ partial "site-favicon.html" . }} {{ partial "site-favicon.html" . }}
{{ end }} {{ end }}

View File

@ -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 }}

View File

@ -30,7 +30,7 @@ module.exports = {
output: { output: {
path: path.join(__dirname, './../static/dist'), path: path.join(__dirname, './../static/dist'),
filename: '[name].[chunkhash].js' filename: 'js/[name].[chunkhash].js'
}, },
resolve: { resolve: {
@ -40,7 +40,7 @@ module.exports = {
plugins: [ plugins: [
new ExtractTextPlugin({ new ExtractTextPlugin({
filename: getPath => { filename: getPath => {
return getPath('[name].[contenthash].css'); return getPath('css/[name].[contenthash].css');
}, },
allChunks: true allChunks: true
}) })