diff options
author | Jason Song <i@wolfogre.com> | 2023-01-19 02:19:38 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-18 12:19:38 -0600 |
commit | 4804900ac935c5f9d4e47c0b0827be4c232bd0e5 (patch) | |
tree | 0633a4da2c4f685fbd999862ac25da5f3d962192 /web_src/js/markup | |
parent | 326d29dce0cf2dcd5478f297d899f098aefaadaa (diff) | |
download | gitea-4804900ac935c5f9d4e47c0b0827be4c232bd0e5.tar.gz gitea-4804900ac935c5f9d4e47c0b0827be4c232bd0e5.zip |
Load asciicast css async (#22502)
Load asciicast css asynchronously.
Related to #22448.
Diffstat (limited to 'web_src/js/markup')
-rw-r--r-- | web_src/js/markup/asciicast.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/web_src/js/markup/asciicast.js b/web_src/js/markup/asciicast.js index d77c05b7aa..902cfcb731 100644 --- a/web_src/js/markup/asciicast.js +++ b/web_src/js/markup/asciicast.js @@ -2,7 +2,10 @@ export async function renderAsciinemaPlayer() { const els = document.querySelectorAll('.asciinema-player-container'); if (!els.length) return; - const player = await import(/* webpackChunkName: "asciinema-player" */'asciinema-player'); + const [player] = await Promise.all([ + import(/* webpackChunkName: "asciinema-player" */'asciinema-player'), + import(/* webpackChunkName: "asciinema-player" */'asciinema-player/dist/bundle/asciinema-player.css'), + ]); for (const el of els) { player.create(el.getAttribute('data-asciinema-player-src'), el, { |