From ac66b7aea90da2ed9ab4f2787bb08ad288d506ba Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Thu, 7 Mar 2024 09:34:30 +0200 Subject: [PATCH 1/3] docs: backport from upstream --- docs/assets/js/color-modes.js | 2 +- docs/content/_index.md | 2 +- docs/layouts/partials/favicons.html | 1 - docs/layouts/partials/footer.html | 25 +++++++++++++------------ docs/layouts/partials/navbar.html | 10 +++++----- docs/layouts/partials/social.html | 24 ++++++++++++++---------- docs/layouts/partials/stylesheet.html | 4 ++-- package.json | 4 ++-- 8 files changed, 38 insertions(+), 34 deletions(-) diff --git a/docs/assets/js/color-modes.js b/docs/assets/js/color-modes.js index f14a3be9d5..738d3641f0 100644 --- a/docs/assets/js/color-modes.js +++ b/docs/assets/js/color-modes.js @@ -1,6 +1,6 @@ /*! * Color mode toggler for Bootstrap's docs (https://getbootstrap.com/) - * Copyright 2011-2023 The Bootstrap Authors + * Copyright 2011-2024 The Bootstrap Authors * Licensed under the Creative Commons Attribution 3.0 Unported License. */ diff --git a/docs/content/_index.md b/docs/content/_index.md index 0976b40dba..5108bcb55f 100644 --- a/docs/content/_index.md +++ b/docs/content/_index.md @@ -35,7 +35,7 @@ composer require twbs/bootstrap-icons Include the icon fonts stylesheet—in your website `` or via `@import` in CSS—from jsDelivr and get started in seconds. [See icon font docs](#icon-font) for examples. {{< highlight html >}} - + {{< /highlight >}} {{< highlight css >}} diff --git a/docs/layouts/partials/favicons.html b/docs/layouts/partials/favicons.html index 520b61a127..58fd96db51 100644 --- a/docs/layouts/partials/favicons.html +++ b/docs/layouts/partials/favicons.html @@ -1,4 +1,3 @@ -{{ "" | safeHTML }} diff --git a/docs/layouts/partials/footer.html b/docs/layouts/partials/footer.html index e340df5b1f..8ec9af27f7 100644 --- a/docs/layouts/partials/footer.html +++ b/docs/layouts/partials/footer.html @@ -2,13 +2,14 @@
- + {{ partial "icons/bootstrap-white-fill.svg" (dict "class" "d-block me-2" "width" "40" "height" "32") }} Bootstrap
@@ -20,7 +21,7 @@
Links
  • Icons
  • Themes
  • Blog
  • -
  • Swag Store
  • +
  • Swag Store
  • diff --git a/docs/layouts/partials/navbar.html b/docs/layouts/partials/navbar.html index 7b7a152567..fbfd2d3c95 100644 --- a/docs/layouts/partials/navbar.html +++ b/docs/layouts/partials/navbar.html @@ -10,7 +10,7 @@ -
    +
    Bootstrap
    @@ -64,6 +64,7 @@
    Bootstrap
  • -
    diff --git a/docs/layouts/partials/social.html b/docs/layouts/partials/social.html index 8e734dabd9..e1bb75a111 100644 --- a/docs/layouts/partials/social.html +++ b/docs/layouts/partials/social.html @@ -1,17 +1,21 @@ -{{ "" | safeHTML }} +{{- $pageTitle := .Title | default .Site.Title | markdownify -}} +{{- $pageDescription := .Page.Params.description | default .Site.Params.description | markdownify -}} +{{- $socialImagePath := .Site.Params.social_image_path -}} + - - - + + + -{{ "" | safeHTML }} - - + + - + - - +{{ with (imageConfig (path.Join "docs/static" $socialImagePath)) -}} + + +{{- end }} diff --git a/docs/layouts/partials/stylesheet.html b/docs/layouts/partials/stylesheet.html index 2502e1b5e1..d9b3233192 100644 --- a/docs/layouts/partials/stylesheet.html +++ b/docs/layouts/partials/stylesheet.html @@ -1,4 +1,4 @@ - + {{- $sassOptions := dict "targetPath" "assets/css/docs.css" "precision" 6 -}} {{- $postcssOptions := dict "use" "autoprefixer" "noMap" true -}} @@ -9,4 +9,4 @@ {{- $style := resources.Get "scss/docs.scss" | toCSS $sassOptions | postCSS $postcssOptions -}} - + diff --git a/package.json b/package.json index 8b90c9dc74..1136e6cf43 100644 --- a/package.json +++ b/package.json @@ -44,8 +44,8 @@ }, "scripts": { "start": "npm run docs-serve", - "docs-serve": "hugo server --port 4000 --disableFastRender", - "docs-build": "hugo --cleanDestinationDir --printUnusedTemplates", + "docs-serve": "hugo server --port 4000 --disableFastRender --noHTTPCache --renderToMemory --printPathWarnings --printUnusedTemplates", + "docs-build": "hugo --cleanDestinationDir --printPathWarnings --printUnusedTemplates", "docs-test": "npm-run-all docs-build docs-test:vnu", "docs-test:vnu": "node build/vnu-jar.mjs", "pages": "node build/build-pages.mjs", From a88e377f87d87b097b9a7c4d143db61b917e7356 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Thu, 7 Mar 2024 14:31:47 +0200 Subject: [PATCH 2/3] Use bootstrap icons in templates when possible --- docs/assets/js/color-modes.js | 11 ++--- docs/layouts/partials/icons/github.svg | 1 - .../layouts/partials/icons/opencollective.svg | 1 - docs/layouts/partials/icons/twitter.svg | 1 - docs/layouts/partials/navbar.html | 40 ++++++------------- 5 files changed, 19 insertions(+), 35 deletions(-) delete mode 100644 docs/layouts/partials/icons/github.svg delete mode 100644 docs/layouts/partials/icons/opencollective.svg delete mode 100644 docs/layouts/partials/icons/twitter.svg diff --git a/docs/assets/js/color-modes.js b/docs/assets/js/color-modes.js index 738d3641f0..2f2770b6ea 100644 --- a/docs/assets/js/color-modes.js +++ b/docs/assets/js/color-modes.js @@ -35,9 +35,9 @@ } const themeSwitcherText = document.querySelector('#bd-theme-text') - const activeThemeIcon = document.querySelector('.theme-icon-active use') - const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"]`) - const svgOfActiveBtn = btnToActive.querySelector('svg use').getAttribute('href') + const activeThemeIcon = document.querySelector('.theme-icon-active') + const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"] i`) + const initialIconOfActiveBtn = [...btnToActive.classList].find(cl => cl.startsWith('bi-')) document.querySelectorAll('[data-bs-theme-value]').forEach(element => { element.classList.remove('active') @@ -46,8 +46,9 @@ btnToActive.classList.add('active') btnToActive.setAttribute('aria-pressed', 'true') - activeThemeIcon.setAttribute('href', svgOfActiveBtn) - const themeSwitcherLabel = `${themeSwitcherText.textContent} (${btnToActive.dataset.bsThemeValue})` + const currentIconOfActiveBtn = [...activeThemeIcon.classList].find(cl => cl.startsWith('bi-')) + activeThemeIcon.classList.replace(currentIconOfActiveBtn, initialIconOfActiveBtn) + const themeSwitcherLabel = `${themeSwitcherText.textContent} (${btnToActive.parentElement.dataset.bsThemeValue})` themeSwitcher.setAttribute('aria-label', themeSwitcherLabel) if (focus) { diff --git a/docs/layouts/partials/icons/github.svg b/docs/layouts/partials/icons/github.svg deleted file mode 100644 index 6f06f7722b..0000000000 --- a/docs/layouts/partials/icons/github.svg +++ /dev/null @@ -1 +0,0 @@ -{{ with .title }}{{ . }}{{ else }}GitHub{{ end }} \ No newline at end of file diff --git a/docs/layouts/partials/icons/opencollective.svg b/docs/layouts/partials/icons/opencollective.svg deleted file mode 100644 index 2896ba50ce..0000000000 --- a/docs/layouts/partials/icons/opencollective.svg +++ /dev/null @@ -1 +0,0 @@ -{{ with .title }}{{ . }}{{ else }}Open Collective{{ end }} \ No newline at end of file diff --git a/docs/layouts/partials/icons/twitter.svg b/docs/layouts/partials/icons/twitter.svg deleted file mode 100644 index 7a7fcee28b..0000000000 --- a/docs/layouts/partials/icons/twitter.svg +++ /dev/null @@ -1 +0,0 @@ -{{ with .title }}{{ . }}{{ else }}Twitter{{ end }} \ No newline at end of file diff --git a/docs/layouts/partials/navbar.html b/docs/layouts/partials/navbar.html index fbfd2d3c95..18dffc21bc 100644 --- a/docs/layouts/partials/navbar.html +++ b/docs/layouts/partials/navbar.html @@ -41,19 +41,19 @@
    Bootstrap
    @@ -64,20 +64,6 @@
    Bootstrap