The Web IDE allows running HTML, CSS and JavaScript code in a sandboxed environment. It is useful for teaching and learning purposes, as well as for testing code snippets. It only supports one HTML, one CSS and one JS file.
To use the Web IDE, you need to wrap your code in a :::webide block. Inside this block, you can use html, css and js code blocks. You can fill the code blocks with boilerplate, or you can leave them empty.
By default, the Web IDE uses a simple template. You can customize the template by adding a html template code block inside the webide block. The default code block is:
The ###CSS###, ###HTML### and ###JS### placeholders will be replaced by the content of the css, html and js code blocks.
Here is an example of a custom template, for example if you want to add a custom library:
Celebrate
// do this for 30 seconds
var duration = 30 * 1000;
var end = Date.now() + duration;
(function frame() {
// launch a few confetti from the left edge
confetti({
particleCount: 7,
angle: 60,
spread: 55,
origin: { x: 0 }
});
// and launch a few from the right edge
confetti({
particleCount: 7,
angle: 120,
spread: 55,
origin: { x: 1 }
});
// keep going until we are out of time
if (Date.now() < end) {
requestAnimationFrame(frame);
}
}());