Browse Source

Prettier

main
Brian Vaughn 7 years ago
parent
commit
56735c44a0
  1. 10
      gatsby-node.js
  2. 2
      package.json
  3. 11
      src/templates/codepen-example.js

10
gatsby-node.js

@ -6,9 +6,9 @@
'use strict'; 'use strict';
const {readdirSync, readFileSync} = require('fs');
const {resolve} = require('path'); const {resolve} = require('path');
const webpack = require('webpack'); const webpack = require('webpack');
const fs = require('fs');
exports.modifyWebpackConfig = ({config, stage}) => { exports.modifyWebpackConfig = ({config, stage}) => {
// See https://github.com/FormidableLabs/react-live/issues/5 // See https://github.com/FormidableLabs/react-live/issues/5
@ -167,10 +167,12 @@ exports.createPages = async ({graphql, boundActionCreators}) => {
toPath: newestBlogNode.fields.slug, toPath: newestBlogNode.fields.slug,
}); });
// Create Codepen example pages. // Create Codepen redirects.
fs.readdirSync('./examples').forEach(file => { // These use the Codepen prefill API to JIT-create Pens.
// https://blog.codepen.io/documentation/api/prefill/
readdirSync('./examples').forEach(file => {
const slug = file.substring(0, file.length - 3); // Trim extension const slug = file.substring(0, file.length - 3); // Trim extension
const code = fs.readFileSync(`./examples/${file}`, 'utf8'); const code = readFileSync(`./examples/${file}`, 'utf8');
createPage({ createPage({
path: `/examples/${slug}`, path: `/examples/${slug}`,

2
package.json

@ -86,4 +86,4 @@
"devDependencies": { "devDependencies": {
"eslint-config-prettier": "^2.6.0" "eslint-config-prettier": "^2.6.0"
} }
} }

11
src/templates/codepen-example.js

@ -60,14 +60,9 @@ class CodepenExample extends Component {
<p> <p>
Not automatically redirecting? Not automatically redirecting?
<br />
<br/><br/> <br />
<input style={primaryStyle} type="submit" value="Click here" />
<input
style={primaryStyle}
type="submit"
value="Click here"
/>
</p> </p>
</form> </form>
</Container> </Container>

Loading…
Cancel
Save