mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-19 04:55:30 -04:00
extract inline page styles into a separate CSS file, and scope to content via SCSS
styles on AMP pages still won't be scoped to div#content like vanilla pages, though
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
{{ $style := resources.Get "sass/main.scss" | resources.ExecuteAsTemplate "sass/main.scss" . | resources.ToCSS (dict "targetPath" "style.css") | resources.PostCSS (dict "config" "postcss.config.js") }}
|
||||
<link rel="stylesheet" href="{{ $style.Permalink }}">
|
||||
|
||||
{{/* Page-specific styles set via front matter */}}
|
||||
{{/* Page-specific styles set via front matter, scoped via SCSS */}}
|
||||
{{ with .Params.css }}
|
||||
<style>
|
||||
{{ . | safeCSS }}
|
||||
</style>
|
||||
{{- $sass := printf "div#content { %s }" . }}
|
||||
{{- $target := path.Join $.File.Dir "inline.scss" }}
|
||||
|
||||
{{- $css := $sass | resources.FromString $target | resources.ToCSS | resources.PostCSS (dict "config" "postcss.config.js") -}}
|
||||
|
||||
<link rel="stylesheet" href="{{ $css.Permalink }}">
|
||||
{{ end }}
|
||||
|
Reference in New Issue
Block a user