Fix issue #42: Use template partial for dynamic elements

This commit is contained in:
Dale Davies
2022-07-19 12:22:32 +01:00
parent 1246964ac6
commit 380093ec19
9 changed files with 11 additions and 78 deletions

View File

@@ -33,6 +33,6 @@
{{/ hastags}}
<span class="unsplash"></span>
<div class="background fixed"></div>
<script defer src="{{{wwwurl}}}/assets/js/index.068ef33aa2ef2fcb48cf.min.js"></script>
{{> partials/jsbundle}}
</body>
</html>

View File

@@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
{{# noindex}}<meta name="robots" content="noindex">{{/ noindex}}
{{# unsplashcolor}}<meta name="theme-color" content="{{unsplashcolor}}">{{/ unsplashcolor}}
<link rel="stylesheet" href="{{{wwwurl}}}/assets/css/styles.efdc3d1d099422476385.min.css">
{{> partials/cssbundle}}
<link rel="stylesheet" href="{{{wwwurl}}}/background-css.php">
<link rel="stylesheet" href="{{{wwwurl}}}/assets/css/weather-icons.min.css">
<link rel="icon" type="image/png" href="{{{wwwurl}}}/favicon.png">

View File

@@ -0,0 +1 @@
<link rel="stylesheet" href="{{{wwwurl}}}/assets/css/styles.efdc3d1d099422476385.min.css">

View File

@@ -0,0 +1 @@
<script defer src="{{{wwwurl}}}/assets/js/index.4a527886f69a6042160d.min.js"></script>

View File

@@ -0,0 +1 @@
<link rel="stylesheet" href="{{{wwwurl}}}/assets/css/<%= _.last(htmlWebpackPlugin.files.css[0].split('/')) %>">

View File

@@ -0,0 +1 @@
<script defer src="{{{wwwurl}}}/assets/js/<%= _.last(htmlWebpackPlugin.files.js[0].split('/')) %>"></script>

View File

@@ -1,38 +0,0 @@
</div>
<span class="time-weather hidden">
<a class="weather widget clickable" href="https://openweathermap.org/">
<span class="weather-info">
<span class="desc"></span>
<span class="temp"></span>
</span>
<i class="weather-icon wi"></i>
</a>
{{# showclock}}<span class="time widget"></span>{{/ showclock}}
</span>
<span class="useclientlocation widget clickable"></span>
<div class="header-bar">
{{# showsearch}}
<span class="search">
<span class="close"></span>
<form class="search-form">
<input type="search">
</form>
<span class="suggestion-list"></span>
</span>
{{/ showsearch}}
{{# hastags }}<a href="#tags" class="show-tags"></a>{{/ hastags }}
</div>
{{# hastags}}
<div id="tags" class="tags">
<span class="header">Tags<span class="close"></span></span>
<ul>
<li><a href="{{{wwwurl}}}/">home</a></li>
{{# tags}}<li><a href="{{{wwwurl}}}/tag/{{.}}/">{{.}}</a></li>{{/ tags}}
</ul>
</div>
{{/ hastags}}
<span class="unsplash"></span>
<div class="background fixed"></div>
<script defer src="{{{wwwurl}}}/assets/js/<%= _.last(htmlWebpackPlugin.files.js[0].split('/')) %>"></script>
</body>
</html>

View File

@@ -1,33 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
{{# noindex}}<meta name="robots" content="noindex">{{/ noindex}}
{{# unsplashcolor}}<meta name="theme-color" content="{{unsplashcolor}}">{{/ unsplashcolor}}
<link rel="stylesheet" href="{{{wwwurl}}}/assets/css/<%= _.last(htmlWebpackPlugin.files.css[0].split('/')) %>">
<link rel="stylesheet" href="{{{wwwurl}}}/background-css.php">
<link rel="stylesheet" href="{{{wwwurl}}}/assets/css/weather-icons.min.css">
<link rel="icon" type="image/png" href="{{{wwwurl}}}/favicon.png">
<title>{{title}}</title>
<script>
const JUMP = {
owmapikey: '{{owmapikey}}',
metrictemp: '{{metrictemp}}',
ampmclock: '{{ampmclock}}',
token: '{{csrftoken}}',
search: '{{{searchjson}}}',
searchengines: '{{{searchengines}}}',
unsplash: '{{{unsplash}}}',
unsplashcolor: '{{unsplashcolor}}',
wwwurl: '{{{wwwurl}}}'
};
</script>
</head>
<body>
<div class="content fixed hidden">
<div class="greeting">
{{# greeting}}<span class="tagname"><span>#</span>{{greeting}}</span>{{/ greeting}}
{{^ greeting}}Good <span class="chosen"></span>{{/ greeting}}
</div>

View File

@@ -42,16 +42,16 @@ module.exports = {
},
plugins: [
new HtmlWebpackPlugin({
filename: path.resolve(__dirname, './jumpapp/templates/header.mustache'),
template: path.resolve(__dirname, './jumpapp/templates/src/header.src.mustache'),
filename: path.resolve(__dirname, './jumpapp/templates/partials/cssbundle.mustache'),
template: path.resolve(__dirname, './jumpapp/templates/partials/src/cssbundle.src.mustache'),
inject: false,
minify: false, // Required to prevent addition of closing tags like body and html.
}),
new HtmlWebpackPlugin({
filename: path.resolve(__dirname, './jumpapp/templates/footer.mustache'),
template: path.resolve(__dirname, './jumpapp/templates/src/footer.src.mustache'),
filename: path.resolve(__dirname, './jumpapp/templates/partials/jsbundle.mustache'),
template: path.resolve(__dirname, './jumpapp/templates/partials/src/jsbundle.src.mustache'),
inject: false,
minify: false, // Required to prevent addition of closing tags like body and html.
minify: false,
}),
new MiniCssExtractPlugin({filename: '../css/[name].[contenthash].min.css'}),
new RemoveEmptyScriptsPlugin(),