[BREAKING] Split-up css into sub-parts (#317)

* Move styles into 3 different locations
- core
- common
- hljs

* Load all stylesheets in proper order
This commit is contained in:
Aditya Telange 2021-03-27 11:28:55 +05:30 committed by GitHub
parent b6af9eddee
commit e503367a1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 9 additions and 2 deletions

View File

@ -27,11 +27,18 @@
<meta name="msvalidate.01" content="{{ .Site.Params.analytics.bing.SiteVerificationTag }}" /> <meta name="msvalidate.01" content="{{ .Site.Params.analytics.bing.SiteVerificationTag }}" />
{{- end}} {{- end}}
<!-- Styles --> <!-- Styles -->
{{- $common := (resources.Match "css/*.css") | resources.Concat "assets/css/common.css" }} {{- $theme_vars := (resources.Get "css/core/theme-vars.css") }}
{{- $reset := (resources.Get "css/core/reset.css") }}
{{- $media := (resources.Get "css/core/zmedia.css") }}
{{- $hljs := (resources.Get "css/hljs/an-old-hope.min.css") }}
{{- $common := (resources.Match "css/common/*.css") | resources.Concat "assets/css/common.css" }}
{{- /* order is important */}}
{{- $core := (slice $theme_vars $reset $common $hljs $media) | resources.Concat "assets/css/core.css" }}
{{- $extended := (resources.Match "css/extended/*.css") | resources.Concat "assets/css/extended.css" }} {{- $extended := (resources.Match "css/extended/*.css") | resources.Concat "assets/css/extended.css" }}
{{- /* bundle all required css */}} {{- /* bundle all required css */}}
{{- /* Add extended css after theme style */ -}} {{- /* Add extended css after theme style */ -}}
{{- $stylesheet := (slice $common $extended) | resources.Concat "assets/css/stylesheet.css" | minify }} {{- $stylesheet := (slice $core $extended) | resources.Concat "assets/css/stylesheet.css" | minify }}
{{- if not .Site.Params.assets.disableFingerprinting }} {{- if not .Site.Params.assets.disableFingerprinting }}
{{- $stylesheet := $stylesheet | fingerprint -}} {{- $stylesheet := $stylesheet | fingerprint -}}