index.css 3.41 KB
Newer Older
1
{{- .Scratch.Set "sitevar" $.Site -}}
2
{{- partial "css/color/parse_color.css" .Scratch -}}
3 4 5 6
{{- .Scratch.Set "background_src" "" -}}
{{- .Scratch.Set "background_src_medium" "" -}}
{{- .Scratch.Set "background_src_small" "" -}}
{{- $scr := .Scratch -}}
7
{{- with $.Site.Params.background.src -}}
8 9 10
  {{- $scr.Set "background_src" . -}}
  {{- $scr.Set "background_src_medium" . -}}
  {{- $scr.Set "background_src_small" . -}}
11 12
{{- end -}}
{{- with $.Site.Params.background.medium_src -}}
13 14
  {{- $scr.Set "background_src_medium" . -}}
  {{- $scr.Set "background_src_small" . -}}
15 16
{{- end -}}
{{- with $.Site.Params.background.small_src -}}
17
  {{- $scr.Set "background_src_small" . -}}
18
{{- end -}}
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
{{- if ($.Site.Params.background.tile) -}}
  {{- .Scratch.Set "background_tile" "repeat" -}}
{{- else -}}
  {{- .Scratch.Set "background_tile" "no-repeat" -}}
{{- end -}}
{{- if ($.Site.Params.background.fit_width) -}}
  {{- .Scratch.Set "background_fit" "contain" -}}
{{- else -}}
  {{- if $.Site.Params.background.tile -}}
    {{- .Scratch.Set "background_fit" "auto" -}}
  {{- else -}}
    {{- .Scratch.Set "background_fit" "cover" -}}
  {{- end -}}
{{- end -}}
{{- if ($.Site.Params.background.fit) -}}
  {{- if eq $.Site.Params.background.fit "cover" -}}
    {{- .Scratch.Set "background_fit" "cover" -}}
  {{- else if eq $.Site.Params.background.fit "contain" -}}
    {{- .Scratch.Set "background_fit" "contain" -}}
  {{- else -}}
    {{- .Scratch.Set "background_fit" "auto" -}}
  {{- end -}}
{{- end -}}
42
{{- $scr := .Scratch -}}
43 44 45 46
{{- range $label := (slice "main_bg" "alt_bg" "accent") -}}
  {{- $scr.Set "label" $label -}}
  {{- partial "css/color/detect_light_or_dark.css" $scr -}}
{{- end -}}
47

48
{{- .Scratch.Add "css" (partial "css/handwriting.css" .Scratch) -}}
49
{{- .Scratch.Add "css" (partial "css/fonts.css" .Scratch) -}}
50
{{- .Scratch.Add "css" (partial "css/single.css" .Scratch) -}}
51
{{- .Scratch.Add "css" (partial "css/forms.css" .Scratch) -}}
52
{{- .Scratch.Add "css" (partial "css/table.css" .Scratch) -}}
53 54 55
{{- .Scratch.Add "css" (partial "css/list.css" .Scratch) -}}
{{- if ($.Site.Params.hashover) -}}{{- .Scratch.Add "css" (partial "css/hashover.css" .Scratch) -}}{{- end -}}
{{- .Scratch.Add "css" (partial "css/print.css" .Scratch) -}}
Michael Bryant's avatar
Michael Bryant committed
56
{{- .Scratch.Add "css" (partial "css/figure.css" .Scratch) -}}
57
{{- .Scratch.Add "css" (partial "css/iubenda.css" .Scratch) -}}
Michael Bryant's avatar
Michael Bryant committed
58

59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
{{- /* Add any CSS from shortcodes */ -}}
{{- partial "shortcodes/get_list.html" $ -}}
{{- range $name := ($.Scratch.Get "shortcodes") -}}
    {{- $.Scratch.Set "page_has_shortcode" false -}}
    {{- range $page := $.Site.Pages -}}
        {{- if and (ne ($.Scratch.Get "page_has_shortcode") true) ($page.HasShortcode $name) -}}
            {{- $.Scratch.Set "page_has_shortcode" true -}}
            {{- $.Scratch.Set "shortcode_name" $name -}}
            {{- partial "shortcodes/definition.html" $ -}}
            {{- $shortcode := $.Scratch.Get "shortcode" -}}
            {{- with (index $shortcode "css") -}}
                {{- $.Scratch.Add "css" (partial . $.Scratch) -}}
            {{- end -}}
        {{- end -}}
    {{- end -}}
{{- end -}}


77 78 79 80 81
{{- if $.Site.Params.no_minimize -}}
{{- .Scratch.Get "css" -}}
{{- else -}}
{{- .Scratch.Get "css" | replaceRE "(?m)(;\\s+)" ";" | replaceRE "(?m)(\\s*{\\s*)" "{" | replaceRE "(?m)(\\s*}\\s*)" "}" | replaceRE "(?m)(\\s*:\\s*)" ":" | replaceRE "(?m)(\\s*,\\s*)" "," | replaceRE "\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\/" "" | replaceRE "(?m)(\\s+)" " " -}}
{{- end -}}