Static template for pure HTML/CSS/JSSee original GitHub issue
Tell us how you think we can improve Sandpack
It would be wonderful to have a “static” template that skips all bundling, and renders the HTML/CSS/JS provided.
My usecase: some of my sandpacks are meant to show CSS things. I want to have an HTML file with a
<style> tag, so that the user can see the result and poke at the CSS.
I tried to do something similar using the
vanilla template, but it seems as though anything added to the
<head> of the HTML doc is blown away by the bundler.
Here’s a codesandbox demonstrating the issue: https://codesandbox.io/s/vigorous-williams-fol3rg?file=/src/App.js
How would your idea work?
I imagine it could work like the “static” template on CodeSandbox.
Though, one issue: the “static” template on CodeSandbox doesn’t have any sort of hot reloading. You have to save the file to see the results. Sandpack doesn’t have a “save” mechanism, so maybe it could trigger the reload when the user stops typing, with a debounce?
Alternatively: maybe the
vanilla template could be updated so that stuff in the
<head> is preserved? I don’t mind using a more-sophisticated template, but right now it doesn’t seem possible.
- Created a year ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
Hey there! I just wanted to jump on the back of this discussion and see if @joshwcomeau or others have found a workaround for the time being? It would be pretty amazing to have this feature.
Keep up the amazing work on sandpack y’all, it’s great stuff!
HII! Is there any update in this matter?? I would love to use Sandpack also for teach some CSS to my students and as @joshwcomeau said,
Looking forward to it!
¡Thanks a lot!