Implement Hugo Pipes to process sass and js. Gulp now only for lint.

This commit is contained in:
Fredrik Jonsson 2019-03-09 16:38:53 +01:00
commit 336b3156ca
8 changed files with 1343 additions and 1668 deletions

View file

@ -6,7 +6,7 @@
<title>{{ block "title" . }}{{ .Title }} – {{ .Site.Title }}{{ end }}</title>
{{ block "meta" . }}{{ end }}
{{- partial "meta.html" . -}}
{{- partialCached "meta_cache.html" . -}}
{{- partial "styles.html" . -}}
{{ block "header" . }}{{ end }}
{{ if and .Site.Params.piwikTrackerUrl .Site.Params.piwikSiteID }}{{ partialCached "matomo.html" . }}{{ end -}}
</head>
@ -40,6 +40,5 @@
</div>
{{ if $.Param "mobilemenu" }}{{ partial "mobilemenu.html" . }}{{ end -}}
{{ partial "scripts.html" . -}}
{{ partialCached "scripts_cache.html" . -}}
</body>
</html>

View file

@ -1,4 +1,3 @@
<!-- Matomo -->
<script type="text/javascript">
var _paq = window._paq || [];
_paq.push(['trackPageView']);
@ -11,4 +10,3 @@
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->

View file

@ -1,2 +0,0 @@
<link rel="stylesheet" href="{{ "/css/styles.css" | relURL }}{{ if $.Param "cacheBustCSS" }}?{{ readFile "/public/css/styles.css" | sha1 }}{{ end }}">
<link rel="stylesheet" href="{{ "/css/print.css" | relURL }}" media="print">

View file

@ -1,2 +1,10 @@
{{ if $.Param "jquery" }}<script src="{{ "/js/jquery.slim.min.js" | relURL }}"></script>{{ end }}
{{ if and ($.Param "jquery") ($.Param "contactform") }}<script src="/js/contact.js"></script>{{ end }}
{{ if $.Param "jquery" -}}
{{ $jquery := resources.Get "js/jquery.slim.min.js" | fingerprint -}}
<script src="{{ $jquery.RelPermalink }}"></script>
{{ $script := resources.Get "js/script.js" | minify | fingerprint -}}
<script src="{{ $script.RelPermalink }}"></script>
{{ if $.Param "contactform" -}}
{{ $contact := resources.Get "js/contact.js" | minify | fingerprint -}}
<script src="{{ $contact.RelPermalink }}"></script>
{{ end -}}
{{ end -}}

View file

@ -1 +0,0 @@
{{ if $.Param "jquery" }}<script src="{{ "/js/script.js" | relURL }}{{ if $.Param "cacheBustJS" }}?{{ readFile "/public/js/script.js" | sha1 }}{{ end }}"></script>{{ end }}

View file

@ -23,6 +23,6 @@
"publisher": {
"@type": "Organization",
"name": {{ .Site.Title | jsonify }},
"url": "{{ .Site.BaseURL }}",
"url": "{{ .Site.BaseURL }}"
}
</script>

View file

@ -26,7 +26,7 @@
"publisher": {
"@type": "Organization",
"name": {{ .Site.Title | jsonify }},
"url": "{{ .Site.BaseURL }}",
"url": "{{ .Site.BaseURL }}"
}
}
</script>

View file

@ -0,0 +1,12 @@
{{ $main_options := (dict "targetPath" "css/styles.css" "outputStyle" "compressed" "includePaths" (slice "assets/lib/typey/stylesheets")) -}}
{{ $print_options := (dict "targetPath" "css/print.css" "outputStyle" "compressed" "includePaths" (slice "assets/lib/typey/stylesheets")) -}}
{{ $main_style := resources.Get "sass/styles.scss" | toCSS $main_options | fingerprint -}}
{{ $print_style := resources.Get "sass/print.scss" | toCSS $print_options | fingerprint -}}
{{ if eq .Hugo.Environment "dev" -}}
{{ $main_options = (dict "targetPath" "css/styles.css" "outputStyle" "nested" "enableSourceMap" true "includePaths" (slice "assets/lib/typey/stylesheets")) -}}
{{ $print_options = (dict "targetPath" "css/print.css" "outputStyle" "nested" "enableSourceMap" true "includePaths" (slice "assets/lib/typey/stylesheets")) -}}
{{ $main_style = resources.Get "sass/styles.scss" | toCSS $main_options -}}
{{ $print_style = resources.Get "sass/print.scss" | toCSS $print_options -}}
{{ end -}}
<link rel="stylesheet" href="{{ $main_style.RelPermalink }}">
<link rel="stylesheet" href="{{ $print_style.RelPermalink }}" media="print">