diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 1d372fb..0123f80 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -4,6 +4,9 @@ title: Hugo Fresh Theme theme: hugo-fresh params: + font: + name: "Open Sans" + sizes: [400,600] hero: # Main hero title title: Manage. Deploy. diff --git a/layouts/partials/css.html b/layouts/partials/css.html index fc1c082..241d5bb 100644 --- a/layouts/partials/css.html +++ b/layouts/partials/css.html @@ -1,9 +1,12 @@ {{- $inServerMode := .Site.IsServer }} -{{- $sass := "style.sass" }} -{{- $cssTarget := "css/style.css" }} -{{- $cssOpts := cond ($inServerMode) (dict "targetPath" $cssTarget "enableSourceMap" true) (dict "targetPath" $cssTarget "outputStyle" "compressed") }} +{{- $sass := "style.sass" }} +{{- $cssTarget := "css/style.css" }} +{{- $cssOpts := cond ($inServerMode) (dict "targetPath" $cssTarget "enableSourceMap" true) (dict "targetPath" $cssTarget "outputStyle" "compressed") }} +{{- $fontFace := replace .Site.Params.font.name " " "+" }} +{{- $fontSizes := delimit .Site.Params.font.sizes "," }} +{{- $fontUrl := printf "https://fonts.googleapis.com/css?family=%s:%s" $fontFace $fontSizes }} - + {{- if $inServerMode }} {{- $css := resources.Get $sass | toCSS $cssOpts }}