mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-01 05:36:19 +01:00
Load asciicast css async (#22502)
Load asciicast css asynchronously. Related to #22448.
This commit is contained in:
parent
326d29dce0
commit
4804900ac9
2 changed files with 4 additions and 3 deletions
|
@ -2,7 +2,10 @@ export async function renderAsciinemaPlayer() {
|
||||||
const els = document.querySelectorAll('.asciinema-player-container');
|
const els = document.querySelectorAll('.asciinema-player-container');
|
||||||
if (!els.length) return;
|
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) {
|
for (const el of els) {
|
||||||
player.create(el.getAttribute('data-asciinema-player-src'), el, {
|
player.create(el.getAttribute('data-asciinema-player-src'), el, {
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
@import "../asciinema-player/dist/bundle/asciinema-player.css";
|
|
||||||
|
|
||||||
.asciinema-player-container {
|
.asciinema-player-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
|
|
Loading…
Reference in a new issue