Skip to content

Commit

Permalink
docs: move search style to its own CSS file
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-deramond authored and XhmikosR committed Mar 19, 2024
1 parent d867ee0 commit 6922f5d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
2 changes: 0 additions & 2 deletions site/assets/scss/_search.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// stylelint-disable selector-class-pattern

@import "@docsearch/css/dist/style";

:root {
--docsearch-primary-color: var(--bd-violet);
--docsearch-logo-color: var(--bd-violet);
Expand Down
1 change: 0 additions & 1 deletion site/assets/scss/docs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ $enable-cssgrid: true;
// Load docs components
@import "variables";
@import "navbar";
@import "search";
@import "masthead";
@import "ads";
@import "content";
Expand Down
14 changes: 14 additions & 0 deletions site/assets/scss/search.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*!
* Bootstrap Docs (https://getbootstrap.com/)
* Copyright 2024 The Bootstrap Authors
* Licensed under the Creative Commons Attribution 3.0 Unported License.
* For details, see https://creativecommons.org/licenses/by/3.0/.
*/

@import "../../../scss/functions";
@import "../../../scss/variables";
@import "../../../scss/mixins";
@import "variables";

@import "@docsearch/css/dist/style";
@import "search";
12 changes: 8 additions & 4 deletions site/layouts/partials/stylesheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@
{{- end }}

{{- if (ne .Page.Layout "examples") }}
{{- $targetDocsCssPath := path.Join "/docs" .Site.Params.docs_version "assets/css/docs.css" -}}
{{- $sassOptions := dict "targetPath" $targetDocsCssPath "outputStyle" "expanded" "precision" 6 -}}
{{- $sassOptions := dict "outputStyle" "expanded" "precision" 6 -}}
{{- $postcssOptions := dict "use" "autoprefixer" "noMap" true -}}

{{- $targetDocsCssPath := path.Join "/docs" .Site.Params.docs_version "assets/css/docs.css" -}}
{{- $targetSearchCssPath := path.Join "/docs" .Site.Params.docs_version "assets/css/search.css" -}}

{{ if hugo.IsProduction -}}
{{- $sassOptions = merge $sassOptions (dict "outputStyle" "compressed") -}}
{{- end -}}

{{- $style := resources.Get "scss/docs.scss" | toCSS $sassOptions | postCSS $postcssOptions }}
{{- $docsCss := resources.Get "scss/docs.scss" | toCSS (merge (dict "targetPath" $targetDocsCssPath) $sassOptions) | postCSS $postcssOptions -}}
{{- $searchCss := resources.Get "scss/search.scss" | toCSS (merge (dict "targetPath" $targetSearchCssPath) $sassOptions) | postCSS $postcssOptions -}}

<link href="{{ $style.RelPermalink }}" rel="stylesheet">
<link href="{{ $docsCss.RelPermalink }}" rel="stylesheet">
<link href="{{ $searchCss.RelPermalink }}" rel="stylesheet">
{{- end }}

0 comments on commit 6922f5d

Please sign in to comment.