1 {{/* Returns the file size of all comic files combined in MiB, including the file size unit */}}
2 {{ $.Scratch.Set
"total_size" 0 }}
3 {{ range (where (where .Site.AllPages
"Section" "comic")
"IsPage" true) -}}
4 {{ $comic_id := .File.ContentBaseName -}}
5 {{ $comicFilePath := delimit (slice
"assets/comics/NE_" .Site.Language.Lang
"_" $comic_id
".png")
"" -}}
6 {{ $fileStat := os.Stat $comicFilePath }}
7 {{ $size := $fileStat.Size }}
8 {{ $.Scratch.Add
"total_size" $size }}
10 {{ $total_size := $.Scratch.Get
"total_size" }}
11 {{ $total_size_div := div (float $total_size) (float
1048576) }}
12 {{ printf
"%.0f MiB" $total_size_div -}}