Skip to content

Commit

Permalink
Drop usage of large SVG sprite on homepage and in copy buttons, repla…
Browse files Browse the repository at this point in the history
…cing them with the Icons font
  • Loading branch information
mdo authored and XhmikosR committed Mar 29, 2021
1 parent c934d87 commit a5b19e0
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 41 deletions.
2 changes: 0 additions & 2 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ module:
target: static/apple-touch-icon.png
- source: docs/static/assets/img/favicons/favicon.ico
target: static/favicon.ico
- source: bootstrap-icons.svg
target: static/bootstrap-icons.svg
- source: icons
target: static/assets/icons
- source: font
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/js/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
(function () {
'use strict'

var btnHtml = '<div class="bd-clipboard"><button type="button" class="btn-clipboard" title="Copy to clipboard"><svg class="bi" width="1em" height="1em" fill="currentColor"><use xlink:href="/bootstrap-icons.svg#clipboard"/></svg></button></div>';
var btnHtml = '<div class="bd-clipboard"><button type="button" class="btn-clipboard" title="Copy to clipboard"><i class="bi bi-clipboard"></i></button></div>';

[].slice.call(document.querySelectorAll('div.highlight'))
.forEach(function (element) {
Expand Down
25 changes: 0 additions & 25 deletions docs/assets/scss/docs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -157,28 +157,3 @@
padding-bottom: 4.5rem !important;
}
// stylelint-enable declaration-no-important

// stylelint-disable
@font-face {
font-family: bootstrap-icons;
src: url("../../font/fonts/bootstrap-icons.woff2?231ce25e89ab5804f9a6c427b8d325c9") format("woff2"),
url("../../font/fonts/bootstrap-icons.woff?231ce25e89ab5804f9a6c427b8d325c9") format("woff");
}

[class^="bi-"]::before,
[class*=" bi-"]::before {
display: inline-block;
font-family: bootstrap-icons !important;
font-style: normal;
font-weight: 400 !important;
font-variant: normal;
line-height: 1;
text-transform: none;
vertical-align: -.125em;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

.bi-alarm::before { content: "\f102"; }
.bi-github::before { content: "\f3ed"; }
// stylelint-enable
19 changes: 9 additions & 10 deletions docs/content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ Use the SVG sprite to insert any icon through the `<use>` element. Use the icon'
{{< /md >}}
</div>
<div class="col-md-8">
{{< example >}}

<div class="bd-example" style="font-size: 32px;">
<i class="bi bi-heart-fill"></i>
<i class="bi bi-toggles"></i>
<i class="bi bi-shop"></i>
</div>
{{< highlight html >}}
<svg class="bi" width="32" height="32" fill="currentColor">
<use xlink:href="bootstrap-icons.svg#heart-fill"/>
</svg>
Expand All @@ -76,7 +82,7 @@ Use the SVG sprite to insert any icon through the `<use>` element. Use the icon'
<svg class="bi" width="32" height="32" fill="currentColor">
<use xlink:href="bootstrap-icons.svg#shop"/>
</svg>
{{< /example >}}
{{< /highlight >}}
</div>
</div>

Expand Down Expand Up @@ -171,14 +177,7 @@ If the icons are not purely decorative, make sure you provide an appropriate tex
{{< /highlight >}}
<div class="bd-example">
<i class="bi-github" role="img" style="font-size: 2em" aria-label="GitHub"></i>
</div>
{{< highlight html >}}
<i class="bi-github" role="img" aria-label="GitHub"></i>
{{< /highlight >}}
<div class="bd-example">
<svg class="bi" width="32" height="32" fill="currentColor" role="img" aria-label="Tools">
<use xlink:href="bootstrap-icons.svg#tools"/>
</svg>
<i class="bi-tools" role="img" style="font-size: 2em" aria-label="Tools"></i>
</div>
{{< highlight html >}}
<svg class="bi" ... role="img" aria-label="Tools">
Expand Down
4 changes: 1 addition & 3 deletions docs/layouts/partials/icons.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ <h2 id="icons" class="mb-0">Icons</h2>
<li class="col mb-4"{{ with .Params.tags }} data-tags="{{ delimit . " " }}"{{ end }}{{ with .Params.categories }} data-categories="{{ delimit . " " | lower }}"{{ end }}>
<a class="d-block text-dark text-decoration-none" href="{{ .RelPermalink }}">
<div class="p-3 py-4 mb-2 bg-light text-center rounded">
<svg class="bi" width="1em" height="1em" fill="currentColor">
<use xlink:href="bootstrap-icons.svg#{{ $filename }}"/>
</svg>
<i class="bi bi-{{ $filename }}"></i>
</div>
<div class="name text-muted text-decoration-none text-center pt-1">{{ $filename }}</div>
</a>
Expand Down
1 change: 1 addition & 0 deletions docs/layouts/partials/stylesheet.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<link rel="stylesheet" href="/assets/css/bootstrap.min.css">
<link rel="stylesheet" href="/font/bootstrap-icons.css">

{{- $sassOptions := dict "targetPath" "assets/css/docs.css" "precision" 6 -}}
{{- $postcssOptions := dict "use" "autoprefixer" "noMap" true -}}
Expand Down

0 comments on commit a5b19e0

Please sign in to comment.