diff options
author | Oscar Najera <hi@oscarnajera.com> | 2025-01-06 08:50:31 +0100 |
---|---|---|
committer | Oscar Najera <hi@oscarnajera.com> | 2025-01-06 08:50:31 +0100 |
commit | 1e3f2427d56b0a5fc286a365794ba9338caf985f (patch) | |
tree | 8a1dac87d9af6145cde2949651bdb9c29fa28615 /assets/js | |
parent | 63932c7be1ec12872f9409c5dfaf9bdfb0597620 (diff) | |
download | hugo-minimalist-theme-1e3f2427d56b0a5fc286a365794ba9338caf985f.tar.gz hugo-minimalist-theme-1e3f2427d56b0a5fc286a365794ba9338caf985f.tar.bz2 hugo-minimalist-theme-1e3f2427d56b0a5fc286a365794ba9338caf985f.zip |
load syntax highlight async
Diffstat (limited to 'assets/js')
-rw-r--r-- | assets/js/loads.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/assets/js/loads.js b/assets/js/loads.js new file mode 100644 index 0000000..71e0173 --- /dev/null +++ b/assets/js/loads.js @@ -0,0 +1,14 @@ +function load_js(url) { + let link = document.createElement("link"); + link.rel = "stylesheet"; + link.type = "text/css"; + link.href = url; + let head = document.getElementsByTagName("head")[0]; + head.appendChild(link); +} + +addEventListener("load", function () { + if (document.querySelector(".highlight .chroma")) { + load_js("/css/syntax.css"); + } +}); |