/
Undeadguy
/
matrix-spec
Обзор
Документация
Войти
/
Undeadguy
/
matrix-spec
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
layouts/_partials/head-css.html
38 строк
1 KB
Kévin Commaille
Upgrade docsy to 0.12.0 (#2160)
27 авг 2025, 09:35
Не верифицирован
27 авг 2025, 09:35
4d40691
Код
Авторство
О чём код?
{{- /* A modified version of the head-css.html partial of Docsy, that adds a call to `resources.PostProcess`, allowing post-processing of the generated CSS to remove unused selectors. */ -}} {{ $scssMain := "scss/main.scss" -}} {{ $css := resources.Get $scssMain | toCSS (dict "enableSourceMap" (not hugo.IsProduction)) -}} {{/* NOTE: we only apply `postCSS` in production or for RTL languages. This makes it snappier to develop in Chrome, but it may look sub-optimal in other browsers. */ -}} {{ if eq .Site.Language.LanguageDirection "rtl" -}} {{ $css = $css | postCSS (dict "use" "autoprefixer rtlcss" "noMap" true) | resources.Copy (replace $scssMain "." ".rtl.") -}} {{ else if hugo.IsProduction -}} {{ $css = $css | postCSS -}} {{ end -}} {{ if hugo.IsProduction -}} {{ $css = $css | minify | fingerprint | resources.PostProcess -}} <link rel="preload" href="{{ $css.RelPermalink }}" as="style" integrity="{{ $css.Data.Integrity }}" crossorigin="anonymous"> {{ end -}} {{ with $css -}} <link href="{{ .RelPermalink }}" rel="stylesheet" {{- with .Data.Integrity }} integrity="{{ . }}" crossorigin="anonymous"{{ end -}} > {{ else -}} {{ errorf "Resource not found or error building CSS: %s" $scssMain -}} {{ end -}} {{- /**/ -}}