Skip to content

Commit 4804900

Browse files
authored
Load asciicast css async (#22502)
Load asciicast css asynchronously. Related to #22448.
1 parent 326d29d commit 4804900

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

web_src/js/markup/asciicast.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ export async function renderAsciinemaPlayer() {
22
const els = document.querySelectorAll('.asciinema-player-container');
33
if (!els.length) return;
44

5-
const player = await import(/* webpackChunkName: "asciinema-player" */'asciinema-player');
5+
const [player] = await Promise.all([
6+
import(/* webpackChunkName: "asciinema-player" */'asciinema-player'),
7+
import(/* webpackChunkName: "asciinema-player" */'asciinema-player/dist/bundle/asciinema-player.css'),
8+
]);
69

710
for (const el of els) {
811
player.create(el.getAttribute('data-asciinema-player-src'), el, {

web_src/less/markup/asciicast.less

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
@import "../asciinema-player/dist/bundle/asciinema-player.css";
2-
31
.asciinema-player-container {
42
width: 100%;
53
height: auto;

0 commit comments

Comments
 (0)