Skip to content

Instantly share code, notes, and snippets.

@jukefr
Created August 15, 2018 20:18
Show Gist options
  • Save jukefr/39e6408cb667855f2bea702609c7a9c6 to your computer and use it in GitHub Desktop.
Save jukefr/39e6408cb667855f2bea702609c7a9c6 to your computer and use it in GitHub Desktop.
Asciinema Player Vue Component
<template>
<figure :id="id"></figure>
</template>
<script>
export default {
props: ['id'],
data() {
return {
source: `https://asciinema.org/a/${this.id}.js`,
ascid: `asciicast-${this.id}`
}
},
mounted() {
// Can't use script tags directly apparently
let asciiscript = document.createElement('script');
asciiscript.setAttribute('src', this.source);
asciiscript.setAttribute('id', this.ascid);
console.log(this.id);
document.getElementById(this.id).appendChild(asciiscript)
}
}
</script>
@a1300
Copy link

a1300 commented Sep 25, 2019

@jukefr nice snippet!

Would you mind to add a LICENCE file to this gist?

Thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment