mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
8af8e806d7
* refactor(assets): integrate UnoCSS for utility classes - Add UnoCSS with presetWind3 as pre-built CSS (assets/css/unocss.css) - Add uno.config.ts with theme breakpoints, colors, safelist, and blocklist - Replace SCSS utility classes with UnoCSS atomic classes: - d-none → hidden - d-none-desktop → sm:hidden - d-none-mobile → max-sm:hidden - order-* (safelist) - variant-numeric → tabular-nums lining-nums - Rename .blur to .is-blur to avoid UnoCSS conflict - Add @unocss-skip comments for SVG path elements to prevent false positives - Remove redundant _utilities.scss ($orders map) and simplify _common.scss - Update documentation (CLAUDE.md, CONTRIBUTING.md, copilot-instructions.md) * refactor(assets): replace 404/offline SCSS with UnoCSS atomic classes - Replace _404.scss styles with atomic classes on template elements - Replace _offline.scss styles with atomic classes on template elements - Keep selectors (id/class) as user customization hooks - Delete assets/scss/pages/_404.scss and _offline.scss * refactor(assets): simplify SCSS with UnoCSS atomic classes - Replace _bilibili.scss with atomic classes (relative, aspect-video, inset-0) - Replace _version.scss with atomic classes (whitespace-nowrap, align-text-bottom) - Replace _noscript-warning.scss with atomic classes (bg-danger, fixed, z-200) - Add semantic z-index shortcuts (z-hide, z-auto, z-base, z-loading, z-sticky, z-fixed) - Add h1-h6 to UnoCSS blocklist to prevent false positives - Use Source path for UnoCSS CSS loading to enable Hugo minify * chore(assets): minor SCSS and template cleanup * fix(assets): add secondary color to UnoCSS theme config text-secondary was broken because the secondary color mapping was missing. * feat(assets): add UnoCSS presetIcons support and z-index shortcuts - Add presetIcons preset with empty collections (ready for custom icon sets) - Add @iconify/json and @iconify/utils devDependencies - Add semantic z-index shortcuts (z-hide, z-auto, z-base, z-loading, z-sticky, z-fixed) - Add secondary color to UnoCSS theme config * refactor(assets): replace SVG icons with UnoCSS presetIcons - Add Lucide and Octicons icon collections to presetIcons config - Replace arrow-up/down and enter-key SVGs with Lucide icons - Replace alert icons (info, light-bulb, report, alert, stop) with Octicons - Delete replaced SVG files from assets/images/icons/ - Keep custom SVGs (csdn, plume, rootme) * refactor(layouts): redesign 404 and offline pages with UnoCSS - Replace translate-y-[30vh] with self-stretch flex centering below header - Remove arbitrary values (text-[3.6rem], text-[1.8rem], etc.) - Restore @page print styles in _common.scss - Simplify offline page layout (icon + title + text) - Fix hardcoded #57606a → text-secondary
77 lines
3.1 KiB
HTML
77 lines
3.1 KiB
HTML
{{- /*
|
|
Stylesheet tag renderer.
|
|
- Accepts direct <link> HTML, a pre-built resource, or builds from source path.
|
|
- Supports template execution, optional toCSS, minify/fingerprint, and preload mode.
|
|
@param {String} [.Source] stylesheet URL/path; if starts with "<link" it's treated as raw HTML
|
|
@param {resource.Resource} [.Resource] pre-built resource (skips build pipeline)
|
|
@param {String} [.Content] inline style content to write as generated resource
|
|
@param {String} [.Path] target path for resource created from Content
|
|
@param {Object} [.Template] target path for resource created from template execution
|
|
@param {Object} [.Context] template context for ExecuteAsTemplate
|
|
@param {Object|Boolean} [.ToCSS] true for defaults, dict for custom toCSS options, false/omit to skip toCSS
|
|
@param {Boolean} [.Minify] whether to minify resource
|
|
@param {String} [.Fingerprint] fingerprint algorithm
|
|
@param {Boolean} [.Crossorigin] whether to add crossorigin=anonymous
|
|
@param {Boolean} [.Preload] whether to output preload + noscript fallback
|
|
@param {String} [.Integrity] SRI hash value
|
|
@param {String} [.Attr] additional attributes
|
|
*/ -}}
|
|
|
|
{{- if strings.HasPrefix (.Source | default "") "<link" -}}
|
|
{{- safeHTML .Source -}}
|
|
{{- else -}}
|
|
{{- $href := "" -}}
|
|
{{- $integrity := .Integrity -}}
|
|
|
|
{{- /* Resource (pre-built) */ -}}
|
|
{{- with .Resource -}}
|
|
{{- $href = .RelPermalink -}}
|
|
{{- with .Data.Integrity -}}
|
|
{{- $integrity = . -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- /* Source build */ -}}
|
|
{{- if .Source | and (not .Resource) | and (not (urls.Parse .Source).Host) -}}
|
|
{{- $resource := resources.Get .Source -}}
|
|
{{- with .Template -}}
|
|
{{- $resource = resources.ExecuteAsTemplate . $.Context $resource -}}
|
|
{{- end -}}
|
|
{{- $resource = dict "Resource" $resource "ToCSS" .ToCSS "Minify" .Minify "Fingerprint" .Fingerprint | partial "function/to-css.html" -}}
|
|
{{- with .Fingerprint -}}
|
|
{{- $integrity = $resource.Data.Integrity -}}
|
|
{{- end -}}
|
|
{{- $href = $resource.RelPermalink -}}
|
|
{{- end -}}
|
|
|
|
{{- /* Style from string */ -}}
|
|
{{- if .Content | and .Path -}}
|
|
{{- $contentResource := resources.FromString .Path .Content -}}
|
|
{{- if .Minify -}}
|
|
{{- $contentResource = $contentResource | minify -}}
|
|
{{- end -}}
|
|
{{- $href = $contentResource.RelPermalink -}}
|
|
{{- end -}}
|
|
|
|
{{- /* Fallback to source */ -}}
|
|
{{- $href = $href | default .Source -}}
|
|
|
|
{{- /* Style attributes */ -}}
|
|
{{- $attrs := printf `href="%v"` $href -}}
|
|
{{- if .Crossorigin -}}
|
|
{{- $attrs = ` crossorigin="anonymous"` | add $attrs -}}
|
|
{{- end -}}
|
|
{{- with $integrity -}}
|
|
{{- $attrs = printf ` integrity="%v"` . | add $attrs -}}
|
|
{{- end -}}
|
|
{{- with .Attr -}}
|
|
{{- $attrs = add " " . | add $attrs -}}
|
|
{{- end -}}
|
|
{{- if .Preload -}}
|
|
<link rel="preload" {{ $attrs | safeHTMLAttr }} as="style" onload="this.removeAttribute('onload');this.rel='stylesheet'">
|
|
<noscript><link rel="stylesheet" {{ $attrs | safeHTMLAttr }}></noscript>
|
|
{{- else -}}
|
|
<link rel="stylesheet" {{ $attrs | safeHTMLAttr }}>
|
|
{{- end -}}
|
|
{{- end -}}
|