Browse Source

Removed HTML boilerplate from examples folder to simplify build script

main
Brian Vaughn 7 years ago
parent
commit
f14eb61e5f
  1. 3
      examples/index.html
  2. 8
      gatsby-node.js

3
examples/index.html

@ -1,3 +0,0 @@
<div id="root">
<!-- This div's content will be managed by React. -->
</div>

8
gatsby-node.js

@ -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,
},
},
});
}
});
};

Loading…
Cancel
Save