Clean up the partials directory
Sort partials into base and site directories
This commit is contained in:
parent
d73c779508
commit
4327d34827
8 changed files with 86 additions and 10 deletions
11
layouts/partials/base/css.html
Normal file
11
layouts/partials/base/css.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
{{ $processedResources := slice }}
|
||||
{{ range $r := resources.Match "css/*.css" }}
|
||||
{{
|
||||
$processedResources = append
|
||||
(resources.Get $r | resources.ExecuteAsTemplate $r (dict "Page" $))
|
||||
$processedResources
|
||||
}}
|
||||
{{ end }}
|
||||
|
||||
{{ $css := $processedResources | resources.Concat "css/base.css" }}
|
||||
{{ return $css }}
|
5
layouts/partials/base/head.html
Normal file
5
layouts/partials/base/head.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title>
|
||||
{{ partialCached "base/head/css.html" . }}
|
||||
{{ partialCached "base/head/js.html" . }}
|
9
layouts/partials/base/head/css.html
Normal file
9
layouts/partials/base/head/css.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
{{- with (partial "base/css.html" .) }}
|
||||
{{- if eq hugo.Environment "development" }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}">
|
||||
{{- else }}
|
||||
{{- with . | minify | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
12
layouts/partials/base/head/js.html
Normal file
12
layouts/partials/base/head/js.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
{{- with resources.Get "js/main.js" }}
|
||||
{{- if eq hugo.Environment "development" }}
|
||||
{{- with . | js.Build }}
|
||||
<script src="{{ .RelPermalink }}"></script>
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- $opts := dict "minify" true }}
|
||||
{{- with . | js.Build $opts | fingerprint }}
|
||||
<script src="{{ .RelPermalink }}" integrity="{{- .Data.Integrity }}" crossorigin="anonymous"></script>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
Loading…
Add table
Add a link
Reference in a new issue