1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-31 00:59:51 +02:00

Use Hugo for our docs Sass and JS. (#29280)

Now there's only one command needed to run the docs: `npm run docs-serve`.

Also, simplify the npm scripts.
This commit is contained in:
XhmikosR
2019-09-17 00:22:49 +03:00
committed by GitHub
parent a9c05ab798
commit 129bb08fc4
35 changed files with 45 additions and 70 deletions

View File

@@ -8,12 +8,13 @@
<script src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
{{- end }}
{{- if eq (getenv "HUGO_ENV") "production" -}}
<script src="/docs/{{ .Site.Params.docs_version }}/assets/js/docs.min.js"></script>
{{- else -}}
<script src="/docs/{{ .Site.Params.docs_version }}/assets/js/vendor/anchor.min.js"></script>
<script src="/docs/{{ .Site.Params.docs_version }}/assets/js/vendor/clipboard.min.js"></script>
<script src="/docs/{{ .Site.Params.docs_version }}/assets/js/vendor/bs-custom-file-input.min.js"></script>
<script src="/docs/{{ .Site.Params.docs_version }}/assets/js/src/application.js"></script>
<script src="/docs/{{ .Site.Params.docs_version }}/assets/js/src/search.js"></script>
{{- end -}}
{{- $vendor := resources.Match "js/vendor/*.js" -}}
{{- $js := resources.Match "js/src/*.js" -}}
{{- $targetDocsJSPath := printf "/docs/%s/assets/js/docs.js" .Site.Params.docs_version -}}
{{- $docsJs := append $js $vendor | resources.Concat $targetDocsJSPath -}}
{{- if (eq (getenv "HUGO_ENV") "production") -}}
{{- $docsJs = $docsJs | resources.Minify -}}
{{- end }}
<script src="{{ $docsJs.Permalink | relURL }}"></script>

View File

@@ -9,6 +9,17 @@
{{- "<!-- Documentation extras -->" | safeHTML }}
<link href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css" rel="stylesheet">
{{- end -}}
{{- if (ne .Page.Layout "examples") }}
<link href="/docs/{{ .Site.Params.docs_version }}/assets/css/docs.min.css" rel="stylesheet">
{{- $targetDocsCssPath := printf "/docs/%s/assets/css/docs.css" .Site.Params.docs_version -}}
{{- $sassOptions := dict "targetPath" $targetDocsCssPath "precision" 6 -}}
{{- $postcssOptions := dict "use" "autoprefixer" "noMap" true -}}
{{- if (eq (getenv "HUGO_ENV") "production") -}}
{{- $sassOptions = merge $sassOptions (dict "outputStyle" "compressed") -}}
{{- end -}}
{{- $style := resources.Get "scss/docs.scss" | toCSS $sassOptions | postCSS $postcssOptions }}
<link rel="stylesheet" href="{{ $style.Permalink | relURL }}">
{{- end }}