From dd21290e1eec9bb45bfb420fc2d8f35ba610035d Mon Sep 17 00:00:00 2001 From: Lea Verou Date: Thu, 11 Jan 2024 21:08:05 +0200 Subject: [PATCH 1/2] Add code snippets for usage via CSS variables --- docs/layouts/icons/single.html | 45 ++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/docs/layouts/icons/single.html b/docs/layouts/icons/single.html index 0d791da886..dbc515f922 100644 --- a/docs/layouts/icons/single.html +++ b/docs/layouts/icons/single.html @@ -110,14 +110,6 @@

Download

Download the SVG to use or edit.

Download SVG -

Icon font

-

Using the web font? Copy, paste, and go.

- -
- {{ $iconFontSnippet := printf `` .File.TranslationBaseName -}} - {{- highlight $iconFontSnippet "html" "" }} -
-

Code point

{{ $codepoints := getJSON "font/bootstrap-icons.json" -}} @@ -138,6 +130,43 @@

Code point

+

Icon font

+

Using the web font? Copy, paste, and go.

+ +
+ {{ $iconFontSnippet := printf `` .File.TranslationBaseName -}} + {{- highlight $iconFontSnippet "html" "" }} +
+ +

Don’t want or can’t modify HTML? No problem, you can also use CSS variables! Define via:

+ + {{ $iconCSSDefSnippet := printf `--bi-%s: "\%s";` .File.TranslationBaseName $hexCodepoint -}} + {{- highlight $iconCSSDefSnippet "css" "" }} + +

+ + Tip: Use on :root to make available on the whole page. +

+ +

Then apply like:

+ + {{ $iconCSSUseSnippet := printf `content: var(--bi-%s);` .File.TranslationBaseName -}} + {{- highlight $iconCSSUseSnippet "css" "" }} + +
+ See Example + {{ $iconCSSExampleSnippet := printf `:root { + %s +} + +.card > footer > a::after { + %s + font-family: bootstrap-icons; +}` $iconCSSDefSnippet $iconCSSUseSnippet -}} + {{- highlight $iconCSSExampleSnippet "css" "" }} +
+ +

Copy HTML

Paste the SVG right into your project's code.

From f531217292a61a754aa62db7d70e366e4fd6f1b5 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Fri, 12 Jan 2024 07:41:58 +0200 Subject: [PATCH 2/2] Update single.html --- docs/layouts/icons/single.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/layouts/icons/single.html b/docs/layouts/icons/single.html index dbc515f922..80c3488dcb 100644 --- a/docs/layouts/icons/single.html +++ b/docs/layouts/icons/single.html @@ -143,10 +143,12 @@

Icon font

{{ $iconCSSDefSnippet := printf `--bi-%s: "\%s";` .File.TranslationBaseName $hexCodepoint -}} {{- highlight $iconCSSDefSnippet "css" "" }} -

- - Tip: Use on :root to make available on the whole page. -

+

+ + + Tip: Use on :root to make available on the whole page. + +

Then apply like:

@@ -166,7 +168,6 @@

Icon font

{{- highlight $iconCSSExampleSnippet "css" "" }} -

Copy HTML

Paste the SVG right into your project's code.