import User from '../models/user'; import Project from '../models/project'; function insertErrorMessage(htmlFile) { const html = htmlFile.split(''); const metaDescription = 'A web editor for p5.js, a JavaScript library with the goal of making coding accessible to artists, designers, educators, and beginners.'; // eslint-disable-line html[0] = ` ${html[0]}
'); }); cssFiles.forEach((file) => { // Add css files as style tags const html = htmlFile.split(''); html[0] = `${html[0]}`; htmlFile = html.join(''); }); linkedFiles.forEach((file) => { // Add linked files as link tags const html = htmlFile.split('
'); html[1] = `${html[1]}`; htmlFile = html.join('
'); }); // Add 404 html and position canvas htmlFile = insertErrorMessage(htmlFile); // Fix links to assets htmlFile = htmlFile.replace( /'assets/g, "'https://rawgit.com/processing/p5.js-website/master/dist/assets/examples/assets/" ); htmlFile = htmlFile.replace( /"assets/g, '"https://rawgit.com/processing/p5.js-website/master/dist/assets/examples/assets/' ); // Change canvas size htmlFile = htmlFile.replace(/createCanvas\(\d+, ?\d+/g, instanceMode ? 'createCanvas(p.windowWidth, p.windowHeight' : 'createCanvas(windowWidth, windowHeight'); callback(htmlFile); }); } else { callback(insertErrorMessage(`