p5.js-web-editor/server/domain-objects/createDefaultFiles.js
2020-05-09 22:17:16 -07:00

48 lines
947 B
JavaScript

const defaultSketch = `function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
}`;
const defaultHTML =
`<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.0.1/p5.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.0.1/addons/p5.dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.0.1/addons/p5.sound.min.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="utf-8" />
</head>
<body>
<script src="sketch.js"></script>
</body>
</html>
`;
const defaultCSS =
`html, body {
margin: 0;
padding: 0;
}
canvas {
display: block;
}
`;
export default function createDefaultFiles() {
return {
'index.html': {
content: defaultHTML
},
'style.css': {
content: defaultCSS
},
'sketch.js': {
content: defaultSketch
}
};
}