Skip to content

Commit 5365174

Browse files
committed
docs: optimize scripts and styles
1 parent 8d21957 commit 5365174

File tree

12 files changed

+573
-49
lines changed

12 files changed

+573
-49
lines changed

docs/assets/js/code-examples.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
* For details, see https://creativecommons.org/licenses/by/3.0/.
1010
*/
1111

12-
/* global ClipboardJS: false, coreui: false */
12+
/* global coreui: false */
13+
import ClipboardJS from 'clipboard'
1314

1415
(() => {
1516
// Insert copy to clipboard button before .highlight
@@ -88,3 +89,4 @@
8889
}, { once: true })
8990
})
9091
})()
92+

docs/assets/js/search.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@
22
// IT'S ALL JUST JUNK FOR OUR DOCS!
33
// ++++++++++++++++++++++++++++++++++++++++++
44

5+
import docsearch from '@docsearch/js'
6+
// https://gohugo.io/hugo-pipes/js/#options
7+
// eslint-disable-next-line import/no-unresolved
8+
import { appId, apiKey, indexName } from '@params';
9+
510
(() => {
611
const searchElement = document.getElementById('docsearch')
712

8-
if (!window.docsearch || !searchElement) {
13+
if (!searchElement) {
914
return
1015
}
1116

12-
window.docsearch({
13-
appId: '5OOVC1SDJS',
14-
apiKey: 'ab4149e82cfd175c0afe647a937a8d21',
15-
indexName: 'coreui',
16-
container: searchElement,
17-
// Set debug to `true` if you want to inspect the dropdown
18-
debug: false
17+
docsearch({
18+
apiKey,
19+
indexName,
20+
appId,
21+
container: searchElement
1922
})
2023
})()

docs/assets/js/vendor/anchor.min.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

docs/assets/js/vendor/clipboard.min.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/assets/scss/docs.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ $enable-cssgrid: true;
3737

3838
// Load docs components
3939
@import "variables";
40-
@import "search";
4140
@import "ads";
4241
@import "content";
4342
@import "skippy";

docs/assets/scss/search.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*!
2+
* Bootstrap Docs (https://getbootstrap.com/)
3+
* Copyright 2024 The Bootstrap Authors
4+
* Licensed under the Creative Commons Attribution 3.0 Unported License.
5+
* For details, see https://creativecommons.org/licenses/by/3.0/.
6+
*/
7+
8+
@import "../../../scss/functions";
9+
@import "../../../scss/variables";
10+
@import "../../../scss/mixins";
11+
@import "variables";
12+
13+
@import "@docsearch/css/dist/style";
14+
@import "search";
15+

docs/layouts/partials/head.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<link rel="canonical" href="{{ .Permalink }}">
1717

1818
{{- if eq .Page.Layout "docs" -}}
19-
<link rel="preconnect" href="https://AK7KMZKZHQ-dsn.algolia.net" crossorigin>
19+
<link rel="preconnect" href="https://{{ .Site.Params.algolia.appId | lower }}-dsn.algolia.net" crossorigin>
2020
{{- end }}
2121

2222
{{ with .Params.robots -}}

0 commit comments

Comments
 (0)