|
|
@ -168,11 +168,8 @@ exports.createPages = async ({graphql, boundActionCreators}) => { |
|
|
|
}); |
|
|
|
|
|
|
|
// Create Codepen example pages
|
|
|
|
const htmlTemplate = fs.readFileSync('./examples/index.html', 'utf8'); |
|
|
|
fs.readdirSync('./examples').forEach(file => { |
|
|
|
// Only create pages for the JS files
|
|
|
|
if (file.endsWith('.js')) { |
|
|
|
const slug = file.substring(0, file.length - 3); |
|
|
|
const slug = file.substring(0, file.length - 3); // Trim extension
|
|
|
|
const jsTemplate = fs.readFileSync(`./examples/${file}`, 'utf8'); |
|
|
|
|
|
|
|
createPage({ |
|
|
@ -181,12 +178,11 @@ exports.createPages = async ({graphql, boundActionCreators}) => { |
|
|
|
context: { |
|
|
|
slug, |
|
|
|
payload: { |
|
|
|
html: htmlTemplate, |
|
|
|
html: '<div id="root"></div>', |
|
|
|
js: jsTemplate, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|