From 797450174d9fc0896beded3015b4090ce49ea000 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Wed, 7 Jul 2021 02:00:47 +0800 Subject: [PATCH] Dynamically detect the sass variables hook --- assets/css/style.scss | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/assets/css/style.scss b/assets/css/style.scss index 236b5de..92cbf59 100644 --- a/assets/css/style.scss +++ b/assets/css/style.scss @@ -1,6 +1,16 @@ --- --- -{% include_relative variables-hook.scss %} +{% comment %} include the variables-hook if it exists {% endcomment %} -@import "jekyll-theme-chirpy"; +{% assign hook = 'variables-hook.scss' %} +{% assign _hook_path = hook | prepend: '/assets/css/' %} +{% assign _hook_obj = site.static_files | where: 'path', _hook_path | first %} + +{% if _hook_obj %} + {% include_relative {{ hook }} %} +{% endif %} + +@import "{{ site.theme }}"; + +// append your custom style below