Skip to content

Commit 56735c4

Browse files
committed
Prettier
1 parent eb6511a commit 56735c4

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

gatsby-node.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
'use strict';
88

9+
const {readdirSync, readFileSync} = require('fs');
910
const {resolve} = require('path');
1011
const webpack = require('webpack');
11-
const fs = require('fs');
1212

1313
exports.modifyWebpackConfig = ({config, stage}) => {
1414
// See https://github.com/FormidableLabs/react-live/issues/5
@@ -167,10 +167,12 @@ exports.createPages = async ({graphql, boundActionCreators}) => {
167167
toPath: newestBlogNode.fields.slug,
168168
});
169169

170-
// Create Codepen example pages.
171-
fs.readdirSync('./examples').forEach(file => {
170+
// Create Codepen redirects.
171+
// These use the Codepen prefill API to JIT-create Pens.
172+
// https://blog.codepen.io/documentation/api/prefill/
173+
readdirSync('./examples').forEach(file => {
172174
const slug = file.substring(0, file.length - 3); // Trim extension
173-
const code = fs.readFileSync(`./examples/${file}`, 'utf8');
175+
const code = readFileSync(`./examples/${file}`, 'utf8');
174176

175177
createPage({
176178
path: `/examples/${slug}`,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,4 @@
8686
"devDependencies": {
8787
"eslint-config-prettier": "^2.6.0"
8888
}
89-
}
89+
}

src/templates/codepen-example.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,9 @@ class CodepenExample extends Component {
6060

6161
<p>
6262
Not automatically redirecting?
63-
64-
<br/><br/>
65-
66-
<input
67-
style={primaryStyle}
68-
type="submit"
69-
value="Click here"
70-
/>
63+
<br />
64+
<br />
65+
<input style={primaryStyle} type="submit" value="Click here" />
7166
</p>
7267
</form>
7368
</Container>

0 commit comments

Comments
 (0)