1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-19 04:35:31 -04:00

inline frontmatter styles in HTML rather than a bunch of baby CSS files

This commit is contained in:
2020-05-14 13:37:33 -04:00
parent 24edb85379
commit 8219c611a4
9 changed files with 24 additions and 13 deletions

View File

@@ -1,9 +1,12 @@
{{ $style := resources.Get "sass/main.scss" | resources.ExecuteAsTemplate "sass/main.scss" . | resources.ToCSS (dict "targetPath" "css/main.css") | resources.PostCSS (dict "config" "postcss.config.js") }}
<link rel="stylesheet" href="{{ $style.Permalink }}">
{{/* Page-specific styles set via front matter, scoped via SCSS */}}
{{/* Page-specific styles set via front matter, scoped via SCSS and inlined */}}
{{ with .Params.css }}
{{- $target := path.Join $.File.Dir "css/inline.scss" }}
{{- $css := . | resources.FromString $target | resources.ToCSS | resources.PostCSS (dict "config" "postcss.config.js") -}}
<link rel="stylesheet" href="{{ $css.Permalink }}">
<style>
{{ $css.Content | safeCSS }}
</style>
{{ end }}