Commit 3802f0ad authored by Kaushal Modi's avatar Kaushal Modi

Use minify and fingerprint from Hugo v0.43-DEV

Hugo Static Site Generator v0.43-DEV-CE84B524:CHROMA-0C0B382
linux/amd64 BuildDate: 2018-07-08T10:02:34-0400
parent 3a9e8477
<!-- https://gist.github.com/carlmjohnson/e3716a0a89fab0484d0552a750c8cfb7 -->
{{- $ast := .asset -}}
{{- with $.Site.Data.assets -}}
{{- if $.Site.Params.cache_busting -}}
{{- if in (string $.Site.BaseURL) "localhost" -}}
{{- $ast | relURL -}}
{{- else -}}
{{- (index . $ast) | relURL -}}
{{- end -}}
{{- else if $.Site.Params.cache_busting_debug -}}
{{- (index . $ast) | relURL -}}
{{- else -}}
{{- $ast | relURL -}}
{{- end -}}
{{- else -}}
{{- $ast | relURL -}}
{{- end -}}
......@@ -2,38 +2,26 @@
{{ range .Site.Params.custom_css }}
{{ $asset := . }}
{{ if $.Site.Params.css_lazy_load }} <!-- If CSS lazy loading is enabled -->
{{ with $.Site.Data.assets }}
{{ if $.Site.Params.cache_busting }}
{{ if in (string .Site.BaseURL) "localhost" }}
<link href="{{ $asset | relURL }}" rel="preload" as="style" onload="this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ $asset | relURL }}"></noscript>
{{ else }}
<link href="{{ (index . $asset) | relURL }}" rel="preload" as="style" onload="this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ (index . $asset) | relURL }}"></noscript>
{{ end }}
{{ else if $.Site.Params.cache_busting_debug }}
<link href="{{ (index . $asset) | relURL }}" rel="preload" as="style" onload="this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ (index . $asset) | relURL }}"></noscript>
{{ else }}
{{ if $.Site.Params.cache_busting }}
{{ if in (string .Site.BaseURL) "localhost" }}
<link href="{{ $asset | relURL }}" rel="preload" as="style" onload="this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ $asset | relURL }}"></noscript>
{{ else }}
{{ $asset_min_cache_busted := resources.Get $asset | minify | fingerprint }}
<link href="{{ $asset_min_cache_busted.RelPermalink }}" rel="preload" as="style" onload="this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ (index . $asset) | relURL }}"></noscript>
{{ end }}
{{ else }}
<link href="{{ $asset | relURL }}" rel="preload" as="style" onload="this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ $asset | relURL }}"></noscript>
{{ end }}
{{ else }} <!-- If CSS lazy loading is disabled (default) -->
{{ with $.Site.Data.assets }}
{{ if $.Site.Params.cache_busting }}
{{ if in (string .Site.BaseURL) "localhost" }}
<link rel="stylesheet" href="{{ $asset | relURL }}">
{{ else }}
<link rel="stylesheet" href="{{ (index . $asset) | relURL }}">
{{ end }}
{{ else if $.Site.Params.cache_busting_debug }}
<link rel="stylesheet" href="{{ (index . $asset) | relURL }}">
{{ else }}
{{ if $.Site.Params.cache_busting }}
{{ if in (string .Site.BaseURL) "localhost" }}
<link rel="stylesheet" href="{{ $asset | relURL }}">
{{ else }}
{{ $asset_min_cache_busted := resources.Get $asset | minify | fingerprint }}
<link rel="stylesheet" href="{{ $asset_min_cache_busted.RelPermalink }}">
{{ end }}
{{ else }}
<link rel="stylesheet" href="{{ $asset | relURL }}">
......
......@@ -6,7 +6,8 @@
<!-- Indieweb badges -->
{{ with .Site.Params.indieweb }}
<a href="https://indieweb.org/">
<img src="{{ (partial "asset.html" (dict "Site" $site "asset" "images/indieweb-badge--optimized.png")) | absURL }}"
{{ $img := resources.Get "images/indieweb-badge--optimized.png" | fingerprint }}
<img src="{{ $img.RelPermalink }}"
width="{{ $badge_width }}" height={{ $badge_height }}
alt="IndieWebCamp" class="pixelated">
</a>
......@@ -21,7 +22,8 @@
Though, that is needed only for PNG images, not SVG.
-->
<img src="{{ (partial "asset.html" (dict "Site" $site "asset" "images/microformats-badge--optimized.png")) | absURL }}"
{{ $img := resources.Get "images/microformats-badge--optimized.png" | fingerprint }}
<img src="{{ $img.RelPermalink }}"
width="{{ $badge_width }}" height={{ $badge_height }}
alt="Microformats2" class="pixelated"></a>
{{- printf `<a href="http://microformats.org/about">?</a>` | safeHTML }}
......@@ -29,7 +31,8 @@
{{ with .webmention }}
<a href="https://indieweb.org/Webmention">
<img src="{{ (partial "asset.html" (dict "Site" $site "asset" "images/webmention-badge--optimized.png")) | absURL }}"
{{ $img := resources.Get "images/webmention-badge--optimized.png" | fingerprint }}
<img src="{{ $img.RelPermalink }}"
width={{ $badge_width }} height={{ $badge_height }}
alt="Webmention" class="pixelated">
</a>
......@@ -40,7 +43,8 @@
<!-- HTML5 badge -->
{{ $html5_validator_link := printf "https://html5.validator.nu/?doc=%s&showsource=yes" $permalink }}
<a href="{{ $html5_validator_link }}">
<img src="{{ (partial "asset.html" (dict "Site" $site "asset" "images/html5-css3-semantics-badge--scaled-optimized.png")) | absURL }}"
{{ $img := resources.Get "images/html5-css3-semantics-badge--scaled-optimized.png" | fingerprint }}
<img src="{{ $img.RelPermalink }}"
width="46" height="18" class="pixelated"
alt="HTML5 Powered with CSS3 / Styling, and Semantics"
title="HTML5 Powered with CSS3 / Styling, and Semantics">
......
......@@ -47,6 +47,7 @@
<!-- With this, links like this will work!
https://scripter.co/hugo-leaf-and-branch-bundles/##Hugo%20considers%20the%20first%20directory%20level
-->
<script defer src="{{ partial "asset.html" (dict "Site" .Site "asset" "js/libs/fragmentions/wrapper.js") }}"></script>
{{ $fragmention_js := resources.Get "js/libs/fragmentions/wrapper.js" | minify | fingerprint }}
<script defer src="{{ $fragmention_js.RelPermalink }}"></script>
{{ partialCached "h-card.html" . }}
......@@ -7,9 +7,10 @@
{{ with .Site.Author }}
<div class="h-card">
{{ with .photo }}
{{ $img := resources.Get .url | fingerprint }}
<img class="u-photo"
{{- with $.Site.Author.name }} alt="Photo of {{ . }}"{{ end }}
src="{{ (partial "asset.html" (dict "Site" $site "asset" .url)) | absURL }}"
src="{{ $img.RelPermalink }}"
{{- with .width }} width="{{ . }}"{{ end -}}
{{- with .height }} height="{{ . }}"{{ end -}}>
{{ end }}
......
......@@ -82,11 +82,10 @@
<!-- Retain the order of loading these CSS files -->
<!-- Tue Nov 28 14:59:22 EST 2017 - kmodi
Do *NOT* lazy load refined.css, as that caused a lot of visual glitch. -->
<!-- <link href="{{/* partial "asset.html" (dict "Site" .Site "asset" "css/refined.css") */}}" rel="preload" as="style" onload="this.rel='stylesheet'"> -->
<!-- <noscript><link rel="stylesheet" href="{{/* partial "asset.html" (dict "Site" .Site "asset" "css/refined.css") */}}"></noscript> -->
<!-- Just load the refined.css directly for now until I get time to figure out
which are the critical components in that CSS that I can inline here. -->
<link rel="stylesheet" href="{{ partial "asset.html" (dict "Site" .Site "asset" "css/refined.css") }}">
{{ $refined_css := resources.Get "css/refined.css" | minify | fingerprint }}
<link rel="stylesheet" href="{{ $refined_css.RelPermalink }}">
{{ partialCached "asset_custom_css.html" . }}
......@@ -116,10 +115,12 @@
</style>
{{ end }}
<script src="{{ partial "asset.html" (dict "Site" .Site "asset" "js/responsive-nav-orig.js") }}"></script>
{{ $resp_nav_js := resources.Get "js/responsive-nav-orig.js" | minify | fingerprint }}
<script src="{{ $resp_nav_js.RelPermalink }}"></script>
<!-- FontAwesome Pro 5.0.11 -->
<script defer src="{{ partial "asset.html" (dict "Site" .Site "asset" "js/libs/fa/fontawesome-all.js") }}"></script>
{{ $fa_js := resources.Get "js/libs/fa/fontawesome-all.js" | minify | fingerprint }}
<script defer src="{{ $fa_js.RelPermalink }}"></script>
{{ with .Params.mathjax }}
{{ partialCached "mathjax.html" $ }}
......@@ -127,11 +128,11 @@
<!-- Icons -->
<!-- Generated using https://realfavicongenerator.net/ -->
<link rel="apple-touch-icon" sizes="180x180" href="{{ partial "asset.html" (dict "Site" .Site "asset" "apple-touch-icon.png") }}">
<link rel="icon" type="image/png" sizes="32x32" href="{{ partial "asset.html" (dict "Site" .Site "asset" "favicon-32x32.png") }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ partial "asset.html" (dict "Site" .Site "asset" "favicon-16x16.png") }}">
<link rel="manifest" href="{{ partial "asset.html" (dict "Site" .Site "asset" "manifest.json") }}">
<link rel="mask-icon" href="{{ partial "asset.html" (dict "Site" .Site "asset" "safari-pinned-tab.svg") }}" color="#5bbad5">
<link rel="apple-touch-icon" sizes="180x180" href="{{ (resources.Get "apple-touch-icon.png" | fingerprint).RelPermalink }}">
<link rel="icon" type="image/png" sizes="32x32" href="{{ (resources.Get "favicon-32x32.png" | fingerprint).RelPermalink }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ (resources.Get "favicon-16x16.png" | fingerprint).RelPermalink }}">
<link rel="manifest" href="{{ (resources.Get "manifest.json" | fingerprint).RelPermalink }}">
<link rel="mask-icon" href="{{ (resources.Get "safari-pinned-tab.svg" | fingerprint).RelPermalink }}" color="#5bbad5">
<meta name="msapplication-TileColor" content="#ffc40d" />
<meta name="theme-color" content="#ffffff" />
......
......@@ -5,7 +5,8 @@
Also move the mathjax config to a separate file from the inline script so
that 'unsafe-inline can also be removed from script-src CSP.
-->
<script src="{{ partial "asset.html" (dict "Site" .Site "asset" "js/mathjax-config.js") }}"></script>
{{ $mathjax_js := resources.Get "js/mathjax-config.js" | minify | fingerprint }}
<script src="{{ $mathjax_js.RelPermalink }}"></script>
<!-- https://gohugo.io/content-management/formats/#mathjax-with-hugo -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS_HTML"></script>
<!-- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_CHTML"></script> -->
<script src="{{ partial "asset.html" (dict "Site" .Site "asset" "js/libs/jquery/3.3.1/jquery.slim.min.js") }}"></script>
{{ $jquery_slim_js := resources.Get "js/libs/jquery/3.3.1/jquery.slim.min.js" | minify | fingerprint }}
<script src="{{ $jquery_slim_js.RelPermalink }}"></script>
<script>(function() {
var $toc = $('#TableOfContents');
if ($toc.length > 0) {
......@@ -35,7 +36,7 @@
https://report-uri.com/home/hash/
'sha256-GHifqkl7lEDJ3LpLU+MiIqEWVMNGYEMoNElqGum/PjY='
(function(){var $toc=$('#TableOfContents');if($toc.length>0){var $window=$(window);function onScroll(){var currentScroll=$window.scrollTop();var h=$('.content h1, .content h2, .content h3, .content h4, .content h5, .content h6, .h-feed h2');var id="";h.each(function(i,e){e=$(e);if(e.offset().top-10<=currentScroll){id=e.attr('id');}});var current=$toc.find('a.current');if(current.length==1&&current.eq(0).attr('href')=='#'+id)return true;current.each(function(i,e){$(e).removeClass('current').siblings('ul').hide();});$toc.find('a[href="#'+id+'"]').parentsUntil('#TableOfContents').each(function(i,e){$(e).children('a').addClass('current').siblings('ul').show();});}
$window.on('scroll',onScroll);$(document).ready(function(){$toc.find('a').parent('li').find('ul').hide();onScroll();document.getElementsByClassName('hugotoc')[0].style.display='';});}})();
(function(){var $toc=$('#TableOfContents');if($toc.length>0){var $window=$(window);function onScroll(){var currentScroll=$window.scrollTop();var h=$('.content h1, .content h2, .content h3, .content h4, .content h5, .content h6, .h-feed h2');var id="";h.each(function(i,e){e=$(e);if(e.offset().top-10<=currentScroll){id=e.attr('id');}});var current=$toc.find('a.current');if(current.length==1&&current.eq(0).attr('href')=='#'+id)return true;current.each(function(i,e){$(e).removeClass('current').siblings('ul').hide();});$toc.find('a[href="#'+id+'"]').parentsUntil('#TableOfContents').each(function(i,e){$(e).children('a').addClass('current').siblings('ul').show();});}
$window.on('scroll',onScroll);$(document).ready(function(){$toc.find('a').parent('li').find('ul').hide();onScroll();document.getElementsByClassName('hugotoc')[0].style.display='';});}})();
-->
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment