diff --git a/assets/shortcodes/_icons.scss b/assets/shortcodes/_icons.scss new file mode 100644 index 0000000..b8ecb8a --- /dev/null +++ b/assets/shortcodes/_icons.scss @@ -0,0 +1,5 @@ +.icon { + width: 2rem; + height: 2rem; + fill: currentColor; +} \ No newline at end of file diff --git a/assets/shortcodes/_index.scss b/assets/shortcodes/_index.scss index be86844..00b695f 100644 --- a/assets/shortcodes/_index.scss +++ b/assets/shortcodes/_index.scss @@ -1 +1,2 @@ -@import "verticalposts"; \ No newline at end of file +@import "verticalposts"; +@import "icons"; \ No newline at end of file diff --git a/layouts/partials/helpers/icons.html b/layouts/partials/helpers/icons.html new file mode 100644 index 0000000..b9e2db2 --- /dev/null +++ b/layouts/partials/helpers/icons.html @@ -0,0 +1,9 @@ +{{ $svg := . }} +{{ $class := print $svg "-icon" }} +{{ $match := "(.*)" }} + +{{ $replaceWith := printf `${2}` $class }} +{{ return (replaceRE $match $replaceWith (printf "/assets/icons/%s.svg" $svg | readFile) | safeHTML) }} + +{{/* Taken from https://bitbanged.com/posts/how-to-use-inline-svgs-with-hugo/ */}} +{{/* Only works if SVG is on one line! */}} \ No newline at end of file