diff --git a/config.toml b/config.toml index 6865055..0f437ba 100644 --- a/config.toml +++ b/config.toml @@ -63,6 +63,14 @@ show_tags = true # ["orange", "blue", "red", "green", "pink"] theme_color = "orange" +# Whether or not to inline CSS in the generated HTML. Can provide +# a performance improvement for some sites. +# This is useful for sites where often only one page is visited by a user. +# In such a case, separately loading/caching the CSS provides no extra +# benefit, and slows down content rendering while waiting the CSS network +# request to start and finish. +inline_css = false + # Custom css to style over the defaults. This is useful when you only have a # few small tweaks to make rather than a major rehaul to the theme. # It would be best to make this a proper .sass or .scss file in sass/ rather diff --git a/templates/macros/head.html b/templates/macros/head.html index 6b4e5b5..17599cd 100644 --- a/templates/macros/head.html +++ b/templates/macros/head.html @@ -7,12 +7,19 @@ -#} {% macro styling() %} - - {% if config.extra.theme_color != "orange" -%} - {% set color = "color/" ~ config.extra.theme_color ~ ".css" -%} - - {%- else -%} - + {% if config.extra.inline_css -%} + {% set styleCSS = load_data(path="public/style.css", format="plain") -%} + + {% else %} + + {% endif %} + {% set color = config.extra.theme_color | default(value="orange") -%} + {% set colorCSS = "color/" ~ color ~ ".css" -%} + {% if config.extra.inline_css -%} + {% set colorCSS = load_data(path="public/" ~ colorCSS, format="plain") -%} + + {% else -%} + {% endif %} {%- if config.extra.custom_css is defined -%}