This repository has been archived by the owner on Nov 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(JS): Initalize JS even if script is loaded after DOMContentLoaded
- Loading branch information
1 parent
8e050b9
commit 7639b4b
Showing
6 changed files
with
34 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
import Prism from 'prismjs' | ||
import 'prismjs/components/prism-javascript' | ||
import 'prismjs/components/prism-json' | ||
import 'prismjs/components/prism-markdown' | ||
import 'prismjs/components/prism-markup' | ||
import 'prismjs/components/prism-python' | ||
import 'prismjs/components/prism-r' | ||
import 'prismjs/plugins/line-highlight/prism-line-highlight' | ||
import 'prismjs/plugins/line-numbers/prism-line-numbers' | ||
|
||
const ready = (): void => { | ||
export const codeHighlight = (): void => { | ||
document | ||
.querySelectorAll('pre[class*="language-"]') | ||
.forEach(node => node.classList.add('line-numbers')) | ||
|
||
Prism.highlightAll() | ||
} | ||
|
||
document.addEventListener('DOMContentLoaded', ready) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { init } from '../../common/js/index' | ||
export { load } from '../../common/js/index' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { init } from '../../common/js/index' | ||
export { load } from '../../common/js/index' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export const init = (): void => { | ||
} | ||
import { load } from '../../common/js/index' | ||
|
||
load() |