Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: load all JS files from node_modules #1518

Merged
merged 1 commit into from
Dec 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ module:
- source: node_modules/bootstrap/scss
target: assets/scss/bootstrap
- source: node_modules/bootstrap/dist/js/bootstrap.min.js
target: assets/js/bootstrap.min.js
target: assets/js/vendor/bootstrap.min.js
- source: node_modules/clipboard/dist/clipboard.min.js
target: assets/js/vendor/clipboard.min.js
- source: node_modules/list.js/dist/list.min.js
target: assets/js/vendor/list.min.js

params:
description: "Official open source SVG icon library for Bootstrap"
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/js/application.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-env browser */

/* global ClipboardJS: false */
/* global ClipboardJS:false */

(function () {
'use strict'
Expand Down
11 changes: 11 additions & 0 deletions docs/assets/js/list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-env browser */

/* global List:false */

(function () {
'use strict'

new List('icons-body', {
valueNames: ['name', { data: ['tags', 'categories'] }]
})
})()
6 changes: 0 additions & 6 deletions docs/assets/js/vendor/bootstrap.min.js

This file was deleted.

7 changes: 0 additions & 7 deletions docs/assets/js/vendor/clipboard.min.js

This file was deleted.

29 changes: 17 additions & 12 deletions docs/layouts/partials/scripts.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
{{- if or .IsHome (eq .Page.Layout "font") }}
<script src="/assets/js/list.min.js"></script>
<script>
new List('icons-body', {
valueNames: ['name', { data: ['tags', 'categories'] }]
});
</script>
{{ $bootstrapJs := resources.Get "/js/vendor/bootstrap.min.js" | resources.Copy "/assets/js/vendor/bootstrap.min.js" -}}
<script async src="{{ $bootstrapJs.Permalink | relURL }}"></script>

{{- if or .IsHome (eq .Page.Layout "font") -}}
{{- $listVendor := resources.Get "js/vendor/list.min.js" -}}
{{- $listJs := resources.Get "js/list.js" -}}
{{- $listBundle := slice $listVendor $listJs | resources.Concat "assets/js/list.js" -}}

{{- if eq hugo.Environment "production" -}}
{{- $listBundle = $listBundle | resources.Minify -}}
{{- end }}
<script async src="{{ $listBundle.Permalink | relURL }}"></script>
{{- end }}

{{- $vendor := resources.Match "js/vendor/*.js" -}}
{{- $js := resources.Match "js/*.js" -}}
{{- $docsJs := append $js $vendor | resources.Concat "assets/js/application.js" -}}
{{- $clipboardVendor := resources.Get "js/vendor/clipboard.min.js" -}}
{{- $applicationJs := resources.Get "js/application.js" -}}
{{- $applicationBundle := slice $clipboardVendor $applicationJs | resources.Concat "assets/js/application.js" -}}

{{- if eq hugo.Environment "production" -}}
{{- $docsJs = $docsJs | resources.Minify -}}
{{- $applicationBundle = $applicationBundle | resources.Minify -}}
{{- end }}
<script async src="{{ $docsJs.Permalink | relURL }}"></script>
<script async src="{{ $applicationBundle.Permalink | relURL }}"></script>
1 change: 0 additions & 1 deletion docs/static/assets/js/list.min.js

This file was deleted.

111 changes: 111 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading