vuejs / repl

Vue SFC REPL as a Vue 3 component
https://repl-vuejs.vercel.app
MIT License
904 stars 159 forks source link

how add Tailwind #240

Closed kr1ke closed 3 months ago

kr1ke commented 4 months ago

how i can add Tailwind in playground?

the only way I found is to insert this code into the vue component:

const tailwindScript = document.createElement('script')
tailwindScript.setAttribute('src', 'https://cdn.tailwindcss.com')
document.head.appendChild(tailwindScript)

but is there a way to run this code by default before starting the sandbox?

sxzz commented 3 months ago

You can pass a prop previewOptions to the Repl component.

<Repl :preview-options="{ headHTML: '<script ... />' }" />