moved mermaid feature to js bundle
This commit is contained in:
parent
28fbd7d906
commit
55c400075c
7 changed files with 16 additions and 16 deletions
3
assets/scripts/features/flowchart/index.js
Normal file
3
assets/scripts/features/flowchart/index.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
if (process.env.FEATURE_FLOWCHART_MERMAID) {
|
||||
import('./mermaid');
|
||||
}
|
7
assets/scripts/features/flowchart/mermaid.js
Normal file
7
assets/scripts/features/flowchart/mermaid.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
import mermaid from 'mermaid';
|
||||
import * as params from '@params';
|
||||
|
||||
const mermaidOptions = params.flowchart?.mermaid || {};
|
||||
const options = Object.assign({}, mermaidOptions, { startOnLoad: true });
|
||||
|
||||
mermaid.initialize(options);
|
|
@ -9,3 +9,7 @@ if (process.env.FEATURE_TOC) {
|
|||
if (process.env.FEATURE_DARKMODE) {
|
||||
import('./darkmode');
|
||||
}
|
||||
|
||||
if (process.env.FEATURE_FLOWCHART) {
|
||||
import('./flowchart');
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Plyr from 'plyr';
|
||||
import { videoplayer } from '@params';
|
||||
import * as params from '@params';
|
||||
|
||||
const { plyr: options } = videoplayer;
|
||||
const options = params.videoplayer?.plyr;
|
||||
window.addEventListener('DOMContentLoaded', () => Plyr.setup('.js-player', options));
|
||||
|
|
|
@ -202,9 +202,4 @@
|
|||
{{ partial "math.html" . }}
|
||||
{{ end }}
|
||||
|
||||
<!-------------- Enable mermaid support for this page ---------------->
|
||||
{{ if .Params.mermaid }}
|
||||
{{ partial "mermaid.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<script src="{{ "/js/mermaid-8.14.0.min.js" | relURL }}"></script>
|
||||
<script>
|
||||
mermaid.initialize({
|
||||
startOnLoad:true
|
||||
});
|
||||
</script>
|
3
static/js/mermaid-8.14.0.min.js
vendored
3
static/js/mermaid-8.14.0.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue