├── index.js ├── .prettierignore ├── .gitattributes ├── assets ├── options-intellisense.png └── resolve-intellisense.png ├── example-site ├── src │ ├── images │ │ ├── gatsby-icon.png │ │ └── gatsby-astronaut.png │ ├── pages │ │ ├── 404.js │ │ ├── page-2.js │ │ ├── index.js │ │ └── using-typescript.tsx │ └── components │ │ ├── header.js │ │ ├── image.js │ │ ├── layout.js │ │ ├── seo.js │ │ └── layout.css ├── gatsby-node.js ├── gatsby-browser.js ├── gatsby-ssr.js ├── LICENSE ├── .gitignore ├── gatsby-config.js ├── package.json └── README.md ├── .prettierrc.js ├── package.json ├── .npmignore ├── .gitignore ├── README.md └── gatsby-node.js /index.js: -------------------------------------------------------------------------------- 1 | module.exports = (config) => config 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | .cache 2 | package.json 3 | package-lock.json 4 | public 5 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /assets/options-intellisense.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TylerBarnes/gatsby-config/HEAD/assets/options-intellisense.png -------------------------------------------------------------------------------- /assets/resolve-intellisense.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TylerBarnes/gatsby-config/HEAD/assets/resolve-intellisense.png -------------------------------------------------------------------------------- /example-site/src/images/gatsby-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TylerBarnes/gatsby-config/HEAD/example-site/src/images/gatsby-icon.png -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | endOfLine: "lf", 3 | semi: false, 4 | singleQuote: false, 5 | tabWidth: 2, 6 | trailingComma: "es5", 7 | } 8 | -------------------------------------------------------------------------------- /example-site/src/images/gatsby-astronaut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TylerBarnes/gatsby-config/HEAD/example-site/src/images/gatsby-astronaut.png -------------------------------------------------------------------------------- /example-site/gatsby-node.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Implement Gatsby's Node APIs in this file. 3 | * 4 | * See: https://www.gatsbyjs.com/docs/node-apis/ 5 | */ 6 | 7 | // You can delete this file if you're not using it 8 | -------------------------------------------------------------------------------- /example-site/gatsby-browser.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Implement Gatsby's Browser APIs in this file. 3 | * 4 | * See: https://www.gatsbyjs.com/docs/browser-apis/ 5 | */ 6 | 7 | // You can delete this file if you're not using it 8 | -------------------------------------------------------------------------------- /example-site/gatsby-ssr.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Implement Gatsby's SSR (Server Side Rendering) APIs in this file. 3 | * 4 | * See: https://www.gatsbyjs.com/docs/ssr-apis/ 5 | */ 6 | 7 | // You can delete this file if you're not using it 8 | -------------------------------------------------------------------------------- /example-site/src/pages/404.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | 3 | import Layout from "../components/layout" 4 | import SEO from "../components/seo" 5 | 6 | const NotFoundPage = () => ( 7 | 8 | 9 |

404: Not Found

10 |

You just hit a route that doesn't exist... the sadness.

11 |
12 | ) 13 | 14 | export default NotFoundPage 15 | -------------------------------------------------------------------------------- /example-site/src/pages/page-2.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import { Link } from "gatsby" 3 | 4 | import Layout from "../components/layout" 5 | import SEO from "../components/seo" 6 | 7 | const SecondPage = () => ( 8 | 9 | 10 |

Hi from the second page

11 |

Welcome to page 2

12 | Go back to the homepage 13 |
14 | ) 15 | 16 | export default SecondPage 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gatsby-config", 3 | "version": "0.1.1", 4 | "description": "A typescript generator for gatsby-config.js plugins. Adds intellisense for Gatsby plugins to your IDE.", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": ["gatsby-plugin", "gatsby"], 10 | "author": "", 11 | "license": "ISC", 12 | "devDependencies": { 13 | "dumper.js": "^1.3.1" 14 | }, 15 | "dependencies": { 16 | "fs-extra": "^9.0.1", 17 | "joi-to-typescript": "^1.4.0", 18 | "pascalcase": "^1.0.0" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /example-site/src/pages/index.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import { Link } from "gatsby" 3 | 4 | import Layout from "../components/layout" 5 | import Image from "../components/image" 6 | import SEO from "../components/seo" 7 | 8 | const IndexPage = () => ( 9 | 10 | 11 |

Hi people

12 |

Welcome to your new Gatsby site.

13 |

Now go build something great.

14 |
15 | 16 |
17 | Go to page 2
18 | Go to "Using TypeScript" 19 |
20 | ) 21 | 22 | export default IndexPage 23 | -------------------------------------------------------------------------------- /example-site/LICENSE: -------------------------------------------------------------------------------- 1 | The BSD Zero Clause License (0BSD) 2 | 3 | Copyright (c) 2020 Gatsby Inc. 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 9 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 10 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 11 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 12 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 13 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 14 | PERFORMANCE OF THIS SOFTWARE. 15 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | example-site 2 | index.d.ts 3 | 4 | # Logs 5 | logs 6 | *.log 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | 13 | # Directory for instrumented libs generated by jscoverage/JSCover 14 | lib-cov 15 | 16 | # Coverage directory used by tools like istanbul 17 | coverage 18 | 19 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 20 | .grunt 21 | 22 | # node-waf configuration 23 | .lock-wscript 24 | 25 | # Compiled binary addons (http://nodejs.org/api/addons.html) 26 | build/Release 27 | 28 | # Dependency directory 29 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git 30 | node_modules 31 | *.un~ 32 | yarn.lock 33 | src 34 | flow-typed 35 | coverage 36 | decls 37 | examples 38 | 39 | *.env* 40 | -------------------------------------------------------------------------------- /example-site/src/components/header.js: -------------------------------------------------------------------------------- 1 | import { Link } from "gatsby" 2 | import PropTypes from "prop-types" 3 | import React from "react" 4 | 5 | const Header = ({ siteTitle }) => ( 6 |
12 |
19 |

20 | 27 | {siteTitle} 28 | 29 |

30 |
31 |
32 | ) 33 | 34 | Header.propTypes = { 35 | siteTitle: PropTypes.string, 36 | } 37 | 38 | Header.defaultProps = { 39 | siteTitle: ``, 40 | } 41 | 42 | export default Header 43 | -------------------------------------------------------------------------------- /example-site/src/components/image.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import { useStaticQuery, graphql } from "gatsby" 3 | import Img from "gatsby-image" 4 | 5 | /* 6 | * This component is built using `gatsby-image` to automatically serve optimized 7 | * images with lazy loading and reduced file sizes. The image is loaded using a 8 | * `useStaticQuery`, which allows us to load the image from directly within this 9 | * component, rather than having to pass the image data down from pages. 10 | * 11 | * For more information, see the docs: 12 | * - `gatsby-image`: https://gatsby.dev/gatsby-image 13 | * - `useStaticQuery`: https://www.gatsbyjs.com/docs/use-static-query/ 14 | */ 15 | 16 | const Image = () => { 17 | const data = useStaticQuery(graphql` 18 | query { 19 | placeholderImage: file(relativePath: { eq: "gatsby-astronaut.png" }) { 20 | childImageSharp { 21 | fluid(maxWidth: 300) { 22 | ...GatsbyImageSharpFluid 23 | } 24 | } 25 | } 26 | } 27 | `) 28 | 29 | if (!data?.placeholderImage?.childImageSharp?.fluid) { 30 | return
Picture not found
31 | } 32 | 33 | return 34 | } 35 | 36 | export default Image 37 | -------------------------------------------------------------------------------- /example-site/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (http://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # Typescript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # dotenv environment variable files 55 | .env* 56 | 57 | # gatsby files 58 | .cache/ 59 | public 60 | 61 | # Mac files 62 | .DS_Store 63 | 64 | # Yarn 65 | yarn-error.log 66 | .pnp/ 67 | .pnp.js 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | -------------------------------------------------------------------------------- /example-site/gatsby-config.js: -------------------------------------------------------------------------------- 1 | const gatsbyConfig = require(`gatsby-config`) 2 | 3 | module.exports = gatsbyConfig({ 4 | siteMetadata: { 5 | title: `Gatsby Default Starter`, 6 | description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`, 7 | author: `@gatsbyjs`, 8 | }, 9 | plugins: [ 10 | `gatsby-config`, 11 | `gatsby-plugin-react-helmet`, 12 | { 13 | resolve: `gatsby-source-filesystem`, 14 | options: { 15 | name: `images`, 16 | path: `${__dirname}/src/images`, 17 | }, 18 | }, 19 | `gatsby-transformer-sharp`, 20 | `gatsby-plugin-sharp`, 21 | { 22 | resolve: `gatsby-plugin-manifest`, 23 | options: { 24 | name: `gatsby-starter-default`, 25 | short_name: `starter`, 26 | start_url: `/`, 27 | background_color: `#663399`, 28 | theme_color: `#663399`, 29 | display: `minimal-ui`, 30 | icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site. 31 | }, 32 | }, 33 | // this (optional) plugin enables Progressive Web App + Offline functionality 34 | // To learn more, visit: https://gatsby.dev/offline 35 | // `gatsby-plugin-offline`, 36 | ], 37 | }) 38 | -------------------------------------------------------------------------------- /example-site/src/components/layout.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Layout component that queries for data 3 | * with Gatsby's useStaticQuery component 4 | * 5 | * See: https://www.gatsbyjs.com/docs/use-static-query/ 6 | */ 7 | 8 | import React from "react" 9 | import PropTypes from "prop-types" 10 | import { useStaticQuery, graphql } from "gatsby" 11 | 12 | import Header from "./header" 13 | import "./layout.css" 14 | 15 | const Layout = ({ children }) => { 16 | const data = useStaticQuery(graphql` 17 | query SiteTitleQuery { 18 | site { 19 | siteMetadata { 20 | title 21 | } 22 | } 23 | } 24 | `) 25 | 26 | return ( 27 | <> 28 |
29 |
36 |
{children}
37 |
40 | © {new Date().getFullYear()}, Built with 41 | {` `} 42 | Gatsby 43 |
44 |
45 | 46 | ) 47 | } 48 | 49 | Layout.propTypes = { 50 | children: PropTypes.node.isRequired, 51 | } 52 | 53 | export default Layout 54 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | index.d.ts 2 | node_modules 3 | public 4 | .cache 5 | .DS_Store 6 | 7 | # Logs 8 | logs 9 | *.log 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Runtime data 15 | pids 16 | *.pid 17 | *.seed 18 | *.pid.lock 19 | 20 | # Directory for instrumented libs generated by jscoverage/JSCover 21 | lib-cov 22 | 23 | # Coverage directory used by tools like istanbul 24 | coverage 25 | 26 | # nyc test coverage 27 | .nyc_output 28 | 29 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 30 | .grunt 31 | 32 | # Bower dependency directory (https://bower.io/) 33 | bower_components 34 | 35 | # node-waf configuration 36 | .lock-wscript 37 | 38 | # Compiled binary addons (http://nodejs.org/api/addons.html) 39 | build/Release 40 | 41 | # Dependency directories 42 | node_modules/ 43 | jspm_packages/ 44 | 45 | # Typescript v1 declaration files 46 | typings/ 47 | 48 | # Optional npm cache directory 49 | .npm 50 | 51 | # Optional eslint cache 52 | .eslintcache 53 | 54 | # Optional REPL history 55 | .node_repl_history 56 | 57 | # Output of 'npm pack' 58 | *.tgz 59 | 60 | # dotenv environment variable files 61 | .env* 62 | 63 | # gatsby files 64 | .cache/ 65 | public 66 | 67 | # Mac files 68 | .DS_Store 69 | 70 | # Yarn 71 | yarn-error.log 72 | .pnp/ 73 | .pnp.js 74 | # Yarn Integrity file 75 | .yarn-integrity 76 | -------------------------------------------------------------------------------- /example-site/src/pages/using-typescript.tsx: -------------------------------------------------------------------------------- 1 | // If you don't want to use TypeScript you can delete this file! 2 | import React from "react" 3 | import { PageProps, Link, graphql } from "gatsby" 4 | 5 | import Layout from "../components/layout" 6 | import SEO from "../components/seo" 7 | 8 | type DataProps = { 9 | site: { 10 | buildTime: string 11 | } 12 | } 13 | 14 | const UsingTypescript: React.FC> = ({ data, path }) => ( 15 | 16 | 17 |

Gatsby supports TypeScript by default!

18 |

This means that you can create and write .ts/.tsx files for your pages, components etc. Please note that the gatsby-*.js files (like gatsby-node.js) currently don't support TypeScript yet.

19 |

For type checking you'll want to install typescript via npm and run tsc --init to create a .tsconfig file.

20 |

You're currently on the page "{path}" which was built on {data.site.buildTime}.

21 |

To learn more, head over to our documentation about TypeScript.

22 | Go back to the homepage 23 |
24 | ) 25 | 26 | export default UsingTypescript 27 | 28 | export const query = graphql` 29 | { 30 | site { 31 | buildTime(formatString: "YYYY-MM-DD hh:mm a z") 32 | } 33 | } 34 | ` 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # gatsby-config 2 | This plugin adds intellisense and autocompletion to `gatsby-config.js` for plugins in the plugins array! It makes Gatsby plugin API's discoverable :) 3 | 4 | Watch this video for a demo https://youtu.be/sGLlEcleumg 5 | 6 | ![Gatsby Plugin resolve intellisense dropdown](https://github.com/TylerBarnes/gatsby-config/blob/main/assets/resolve-intellisense.png) 7 | 8 | ![Gatsby Plugin options intellisense dropdown](https://github.com/TylerBarnes/gatsby-config/blob/main/assets/options-intellisense.png) 9 | 10 | ## Setting it up 11 | 12 | In `gatsby-config.js` add the following: 13 | 14 | ```js 15 | const gatsbyConfig = require(`gatsby-config`) 16 | 17 | module.exports = gatsbyConfig({ 18 | plugins: [ 19 | `gatsby-config`, 20 | // add any other plugins here 21 | ] 22 | }) 23 | ``` 24 | 25 | Now when you run `gatsby develop`, typescript types will be generated for any Gatsby plugins you have installed that implement the `pluginOptionsSchema` Node API (see https://www.gatsbyjs.com/docs/node-apis/#pluginOptionsSchema for more info). Those types will be added to the `gatsbyConfig` helper seen in the example above and that will enable intellisense and autocompletion for those plugins. 26 | 27 | If you're using an IDE which automatically uses TypeScript types for intellisense (like VSCode), you'll be able to use autocompletion and the intellisense dropdown to discover plugin options and read their descriptions and the expected types of values. 28 | 29 | -------------------------------------------------------------------------------- /example-site/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gatsby-starter-default", 3 | "private": true, 4 | "description": "A simple starter to get up and developing quickly with Gatsby", 5 | "version": "0.1.0", 6 | "author": "Kyle Mathews ", 7 | "dependencies": { 8 | "gatsby": "^2.26.1", 9 | "gatsby-config": "^0.1.0", 10 | "gatsby-image": "^2.5.0", 11 | "gatsby-plugin-manifest": "^2.6.1", 12 | "gatsby-plugin-offline": "^3.4.0", 13 | "gatsby-plugin-react-helmet": "^3.4.0", 14 | "gatsby-plugin-sharp": "^2.8.0", 15 | "gatsby-source-filesystem": "^2.5.0", 16 | "gatsby-source-wordpress-experimental": "^5.0.0", 17 | "gatsby-transformer-sharp": "^2.6.0", 18 | "prop-types": "^15.7.2", 19 | "react": "^16.12.0", 20 | "react-dom": "^16.12.0", 21 | "react-helmet": "^6.1.0" 22 | }, 23 | "devDependencies": { 24 | "prettier": "2.1.2" 25 | }, 26 | "keywords": [ 27 | "gatsby" 28 | ], 29 | "license": "0BSD", 30 | "scripts": { 31 | "build": "gatsby build", 32 | "develop": "gatsby develop", 33 | "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"", 34 | "start": "npm run develop", 35 | "serve": "gatsby serve", 36 | "clean": "gatsby clean", 37 | "test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1" 38 | }, 39 | "repository": { 40 | "type": "git", 41 | "url": "https://github.com/gatsbyjs/gatsby-starter-default" 42 | }, 43 | "bugs": { 44 | "url": "https://github.com/gatsbyjs/gatsby/issues" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /example-site/src/components/seo.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SEO component that queries for data with 3 | * Gatsby's useStaticQuery React hook 4 | * 5 | * See: https://www.gatsbyjs.com/docs/use-static-query/ 6 | */ 7 | 8 | import React from "react" 9 | import PropTypes from "prop-types" 10 | import { Helmet } from "react-helmet" 11 | import { useStaticQuery, graphql } from "gatsby" 12 | 13 | function SEO({ description, lang, meta, title }) { 14 | const { site } = useStaticQuery( 15 | graphql` 16 | query { 17 | site { 18 | siteMetadata { 19 | title 20 | description 21 | author 22 | } 23 | } 24 | } 25 | ` 26 | ) 27 | 28 | const metaDescription = description || site.siteMetadata.description 29 | const defaultTitle = site.siteMetadata?.title 30 | 31 | return ( 32 | 73 | ) 74 | } 75 | 76 | SEO.defaultProps = { 77 | lang: `en`, 78 | meta: [], 79 | description: ``, 80 | } 81 | 82 | SEO.propTypes = { 83 | description: PropTypes.string, 84 | lang: PropTypes.string, 85 | meta: PropTypes.arrayOf(PropTypes.object), 86 | title: PropTypes.string.isRequired, 87 | } 88 | 89 | export default SEO 90 | -------------------------------------------------------------------------------- /gatsby-node.js: -------------------------------------------------------------------------------- 1 | const Joi = require(`joi`) 2 | const { convertSchema } = require(`joi-to-typescript`) 3 | const pascalcase = require(`pascalcase`) 4 | const fs = require(`fs-extra`) 5 | 6 | exports.onPreInit = async ({ store }) => { 7 | if (process.env.NODE_ENV !== `development`) { 8 | return 9 | } 10 | 11 | const { flattenedPlugins } = store.getState() 12 | 13 | const flattenedPluginsNames = flattenedPlugins.reduce( 14 | (accumulator, current) => { 15 | accumulator.add(current.name) 16 | return accumulator 17 | }, 18 | new Set() 19 | ) 20 | 21 | const packageJSON = await fs.readJSON(`${process.cwd()}/package.json`) 22 | 23 | const packages = [ 24 | ...Object.keys(packageJSON.dependencies || {}), 25 | ...Object.keys(packageJSON.devDependencies || {}), 26 | ] 27 | 28 | const pluginsNotInGatsbyConfigNames = packages.filter( 29 | (packageName) => 30 | packageName.startsWith(`gatsby-`) && 31 | !flattenedPluginsNames.has(packageName) 32 | ) 33 | 34 | const pluginsNotInGatsbyConfig = pluginsNotInGatsbyConfigNames.map( 35 | (pluginName) => ({ 36 | name: pluginName, 37 | // 38 | // we can't guaruntee this "resolve" path is where this plugin is on disk 39 | // but in the worst case scenario, this plugin will simply 40 | // not have types created for it until it's added to gatsby-config.js 41 | resolve: `${process.cwd()}/node_modules/${pluginName}`, 42 | }) 43 | ) 44 | 45 | let typeString = `` 46 | const pascalNames = [] 47 | 48 | const plugins = [...flattenedPlugins, ...pluginsNotInGatsbyConfig] 49 | 50 | const excludedNames = [ 51 | "dev-404-page", 52 | "bundle-optimisations", 53 | "gatsby-config", 54 | "default-site-plugin", 55 | "internal-data-bridge", 56 | "load-babel-config", 57 | "prod-404", 58 | "webpack-theme-component-shadowing", 59 | ] 60 | 61 | for (const pluginInfo of plugins) { 62 | if (excludedNames.includes(pluginInfo.name)) { 63 | continue 64 | } 65 | 66 | const pascalName = pascalcase(pluginInfo.name) 67 | 68 | let pluginWasTyped = false 69 | 70 | try { 71 | const pluginRequire = require(`${pluginInfo.resolve}/gatsby-node.js`) 72 | 73 | if (pluginRequire.pluginOptionsSchema) { 74 | const schema = pluginRequire 75 | .pluginOptionsSchema({ Joi }) 76 | .label(pascalName) 77 | 78 | let typeContent 79 | 80 | try { 81 | const { content } = convertSchema({}, schema) || {} 82 | 83 | if (content) { 84 | typeContent = content 85 | } 86 | } catch (e) { 87 | if ( 88 | e.message && 89 | e.message.includes(`Cannot convert undefined or null to object`) 90 | ) { 91 | console.warn( 92 | `[gatsby-plugin-config] failed to generate types for ${pluginInfo.name}\nError: ${e.message}\n\n` 93 | ) 94 | 95 | continue 96 | } else { 97 | throw Error(e) 98 | } 99 | } 100 | 101 | if (typeContent) { 102 | typeString += `${typeContent}\n\n` 103 | typeString += `interface ${pascalName}PluginObject { 104 | resolve: "${pluginInfo.name}" 105 | options: ${pascalName} 106 | }\n\n` 107 | pluginWasTyped = true 108 | } 109 | } 110 | 111 | if (!pluginWasTyped) { 112 | const pluginTypeAny = `interface ${pascalName}PluginObject { 113 | resolve: "${pluginInfo.name}" 114 | options: any 115 | }` 116 | 117 | typeString += `${pluginTypeAny}\n\n` 118 | } 119 | } catch (e) { 120 | if (e.message && !e.message.includes(`Cannot find module`)) { 121 | console.error( 122 | `[gatsby-plugin-config] Error occurred while getting types for ${pluginInfo.name}:\n${e.message}` 123 | ) 124 | } 125 | 126 | continue 127 | } 128 | 129 | // we add this at the end because at this point 130 | // if we made it here without continuing, the 131 | // type for this plugin was generated properly 132 | // we don't want to add type names that don't exist 133 | // or it will break intellisense 134 | pascalNames.push(pascalName) 135 | } 136 | 137 | typeString += `type Plugin = ${plugins 138 | .filter(({ name }) => !excludedNames.includes(name)) 139 | .map(({ name }) => `"${name}"`) 140 | .join(` | `)} | ${pascalNames 141 | .map((name) => `${name}PluginObject`) 142 | .join(` | `)} 143 | 144 | interface GatsbyConfigObject { 145 | plugins: Plugin[] 146 | } 147 | 148 | declare const gatsbyConfigObject: (config: GatsbyConfigObject) => GatsbyConfigObject 149 | 150 | export = gatsbyConfigObject;` 151 | 152 | await fs.writeFile(`${__dirname}/index.d.ts`, typeString) 153 | } 154 | -------------------------------------------------------------------------------- /example-site/README.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 | Gatsby 5 | 6 |

7 |

8 | Gatsby's default starter 9 |

10 | 11 | Kick off your project with this default boilerplate. This starter ships with the main Gatsby configuration files you might need to get up and running blazing fast with the blazing fast app generator for React. 12 | 13 | _Have another more specific idea? You may want to check out our vibrant collection of [official and community-created starters](https://www.gatsbyjs.com/docs/gatsby-starters/)._ 14 | 15 | ## 🚀 Quick start 16 | 17 | 1. **Create a Gatsby site.** 18 | 19 | Use the Gatsby CLI to create a new site, specifying the default starter. 20 | 21 | ```shell 22 | # create a new Gatsby site using the default starter 23 | gatsby new my-default-starter https://github.com/gatsbyjs/gatsby-starter-default 24 | ``` 25 | 26 | 1. **Start developing.** 27 | 28 | Navigate into your new site’s directory and start it up. 29 | 30 | ```shell 31 | cd my-default-starter/ 32 | gatsby develop 33 | ``` 34 | 35 | 1. **Open the source code and start editing!** 36 | 37 | Your site is now running at `http://localhost:8000`! 38 | 39 | _Note: You'll also see a second link: _`http://localhost:8000/___graphql`_. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the [Gatsby tutorial](https://www.gatsbyjs.com/tutorial/part-five/#introducing-graphiql)._ 40 | 41 | Open the `my-default-starter` directory in your code editor of choice and edit `src/pages/index.js`. Save your changes and the browser will update in real time! 42 | 43 | ## 🧐 What's inside? 44 | 45 | A quick look at the top-level files and directories you'll see in a Gatsby project. 46 | 47 | . 48 | ├── node_modules 49 | ├── src 50 | ├── .gitignore 51 | ├── .prettierrc 52 | ├── gatsby-browser.js 53 | ├── gatsby-config.js 54 | ├── gatsby-node.js 55 | ├── gatsby-ssr.js 56 | ├── LICENSE 57 | ├── package-lock.json 58 | ├── package.json 59 | └── README.md 60 | 61 | 1. **`/node_modules`**: This directory contains all of the modules of code that your project depends on (npm packages) are automatically installed. 62 | 63 | 2. **`/src`**: This directory will contain all of the code related to what you will see on the front-end of your site (what you see in the browser) such as your site header or a page template. `src` is a convention for “source code”. 64 | 65 | 3. **`.gitignore`**: This file tells git which files it should not track / not maintain a version history for. 66 | 67 | 4. **`.prettierrc`**: This is a configuration file for [Prettier](https://prettier.io/). Prettier is a tool to help keep the formatting of your code consistent. 68 | 69 | 5. **`gatsby-browser.js`**: This file is where Gatsby expects to find any usage of the [Gatsby browser APIs](https://www.gatsbyjs.com/docs/browser-apis/) (if any). These allow customization/extension of default Gatsby settings affecting the browser. 70 | 71 | 6. **`gatsby-config.js`**: This is the main configuration file for a Gatsby site. This is where you can specify information about your site (metadata) like the site title and description, which Gatsby plugins you’d like to include, etc. (Check out the [config docs](https://www.gatsbyjs.com/docs/gatsby-config/) for more detail). 72 | 73 | 7. **`gatsby-node.js`**: This file is where Gatsby expects to find any usage of the [Gatsby Node APIs](https://www.gatsbyjs.com/docs/node-apis/) (if any). These allow customization/extension of default Gatsby settings affecting pieces of the site build process. 74 | 75 | 8. **`gatsby-ssr.js`**: This file is where Gatsby expects to find any usage of the [Gatsby server-side rendering APIs](https://www.gatsbyjs.com/docs/ssr-apis/) (if any). These allow customization of default Gatsby settings affecting server-side rendering. 76 | 77 | 9. **`LICENSE`**: This Gatsby starter is licensed under the 0BSD license. This means that you can see this file as a placeholder and replace it with your own license. 78 | 79 | 10. **`package-lock.json`** (See `package.json` below, first). This is an automatically generated file based on the exact versions of your npm dependencies that were installed for your project. **(You won’t change this file directly).** 80 | 81 | 11. **`package.json`**: A manifest file for Node.js projects, which includes things like metadata (the project’s name, author, etc). This manifest is how npm knows which packages to install for your project. 82 | 83 | 12. **`README.md`**: A text file containing useful reference information about your project. 84 | 85 | ## 🎓 Learning Gatsby 86 | 87 | Looking for more guidance? Full documentation for Gatsby lives [on the website](https://www.gatsbyjs.com/). Here are some places to start: 88 | 89 | - **For most developers, we recommend starting with our [in-depth tutorial for creating a site with Gatsby](https://www.gatsbyjs.com/tutorial/).** It starts with zero assumptions about your level of ability and walks through every step of the process. 90 | 91 | - **To dive straight into code samples, head [to our documentation](https://www.gatsbyjs.com/docs/).** In particular, check out the _Guides_, _API Reference_, and _Advanced Tutorials_ sections in the sidebar. 92 | 93 | ## 💫 Deploy 94 | 95 | [![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/gatsbyjs/gatsby-starter-default) 96 | 97 | [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/gatsbyjs/gatsby-starter-default) 98 | 99 | 100 | -------------------------------------------------------------------------------- /example-site/src/components/layout.css: -------------------------------------------------------------------------------- 1 | html { 2 | -ms-text-size-adjust: 100%; 3 | -webkit-text-size-adjust: 100%; 4 | font: 112.5%/1.45em georgia, serif, sans-serif; 5 | box-sizing: border-box; 6 | overflow-y: scroll; 7 | } 8 | body { 9 | margin: 0; 10 | -webkit-font-smoothing: antialiased; 11 | -moz-osx-font-smoothing: grayscale; 12 | color: hsla(0, 0%, 0%, 0.8); 13 | font-family: georgia, serif; 14 | font-weight: normal; 15 | word-wrap: break-word; 16 | font-kerning: normal; 17 | -moz-font-feature-settings: "kern", "liga", "clig", "calt"; 18 | -ms-font-feature-settings: "kern", "liga", "clig", "calt"; 19 | -webkit-font-feature-settings: "kern", "liga", "clig", "calt"; 20 | font-feature-settings: "kern", "liga", "clig", "calt"; 21 | } 22 | article, 23 | aside, 24 | details, 25 | figcaption, 26 | figure, 27 | footer, 28 | header, 29 | main, 30 | menu, 31 | nav, 32 | section, 33 | summary { 34 | display: block; 35 | } 36 | audio, 37 | canvas, 38 | progress, 39 | video { 40 | display: inline-block; 41 | } 42 | audio:not([controls]) { 43 | display: none; 44 | height: 0; 45 | } 46 | progress { 47 | vertical-align: baseline; 48 | } 49 | [hidden], 50 | template { 51 | display: none; 52 | } 53 | a { 54 | background-color: transparent; 55 | -webkit-text-decoration-skip: objects; 56 | } 57 | a:active, 58 | a:hover { 59 | outline-width: 0; 60 | } 61 | abbr[title] { 62 | border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5); 63 | cursor: help; 64 | text-decoration: none; 65 | } 66 | b, 67 | strong { 68 | font-weight: inherit; 69 | font-weight: bolder; 70 | } 71 | dfn { 72 | font-style: italic; 73 | } 74 | h1 { 75 | margin-left: 0; 76 | margin-right: 0; 77 | margin-top: 0; 78 | padding-bottom: 0; 79 | padding-left: 0; 80 | padding-right: 0; 81 | padding-top: 0; 82 | margin-bottom: 1.45rem; 83 | color: inherit; 84 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, 85 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 86 | font-weight: bold; 87 | text-rendering: optimizeLegibility; 88 | font-size: 2.25rem; 89 | line-height: 1.1; 90 | } 91 | mark { 92 | background-color: #ff0; 93 | color: #000; 94 | } 95 | small { 96 | font-size: 80%; 97 | } 98 | sub, 99 | sup { 100 | font-size: 75%; 101 | line-height: 0; 102 | position: relative; 103 | vertical-align: baseline; 104 | } 105 | sub { 106 | bottom: -0.25em; 107 | } 108 | sup { 109 | top: -0.5em; 110 | } 111 | img { 112 | border-style: none; 113 | max-width: 100%; 114 | margin-left: 0; 115 | margin-right: 0; 116 | margin-top: 0; 117 | padding-bottom: 0; 118 | padding-left: 0; 119 | padding-right: 0; 120 | padding-top: 0; 121 | margin-bottom: 1.45rem; 122 | } 123 | svg:not(:root) { 124 | overflow: hidden; 125 | } 126 | code, 127 | kbd, 128 | pre, 129 | samp { 130 | font-family: monospace; 131 | font-size: 1em; 132 | } 133 | figure { 134 | margin-left: 0; 135 | margin-right: 0; 136 | margin-top: 0; 137 | padding-bottom: 0; 138 | padding-left: 0; 139 | padding-right: 0; 140 | padding-top: 0; 141 | margin-bottom: 1.45rem; 142 | } 143 | hr { 144 | box-sizing: content-box; 145 | overflow: visible; 146 | margin-left: 0; 147 | margin-right: 0; 148 | margin-top: 0; 149 | padding-bottom: 0; 150 | padding-left: 0; 151 | padding-right: 0; 152 | padding-top: 0; 153 | margin-bottom: calc(1.45rem - 1px); 154 | background: hsla(0, 0%, 0%, 0.2); 155 | border: none; 156 | height: 1px; 157 | } 158 | button, 159 | input, 160 | optgroup, 161 | select, 162 | textarea { 163 | font: inherit; 164 | margin: 0; 165 | } 166 | optgroup { 167 | font-weight: 700; 168 | } 169 | button, 170 | input { 171 | overflow: visible; 172 | } 173 | button, 174 | select { 175 | text-transform: none; 176 | } 177 | [type="reset"], 178 | [type="submit"], 179 | button, 180 | html [type="button"] { 181 | -webkit-appearance: button; 182 | } 183 | [type="button"]::-moz-focus-inner, 184 | [type="reset"]::-moz-focus-inner, 185 | [type="submit"]::-moz-focus-inner, 186 | button::-moz-focus-inner { 187 | border-style: none; 188 | padding: 0; 189 | } 190 | [type="button"]:-moz-focusring, 191 | [type="reset"]:-moz-focusring, 192 | [type="submit"]:-moz-focusring, 193 | button:-moz-focusring { 194 | outline: 1px dotted ButtonText; 195 | } 196 | fieldset { 197 | border: 1px solid silver; 198 | padding: 0.35em 0.625em 0.75em; 199 | margin-left: 0; 200 | margin-right: 0; 201 | margin-top: 0; 202 | padding-bottom: 0; 203 | padding-left: 0; 204 | padding-right: 0; 205 | padding-top: 0; 206 | margin-bottom: 1.45rem; 207 | } 208 | legend { 209 | box-sizing: border-box; 210 | color: inherit; 211 | display: table; 212 | max-width: 100%; 213 | padding: 0; 214 | white-space: normal; 215 | } 216 | textarea { 217 | overflow: auto; 218 | } 219 | [type="checkbox"], 220 | [type="radio"] { 221 | box-sizing: border-box; 222 | padding: 0; 223 | } 224 | [type="number"]::-webkit-inner-spin-button, 225 | [type="number"]::-webkit-outer-spin-button { 226 | height: auto; 227 | } 228 | [type="search"] { 229 | -webkit-appearance: textfield; 230 | outline-offset: -2px; 231 | } 232 | [type="search"]::-webkit-search-cancel-button, 233 | [type="search"]::-webkit-search-decoration { 234 | -webkit-appearance: none; 235 | } 236 | ::-webkit-input-placeholder { 237 | color: inherit; 238 | opacity: 0.54; 239 | } 240 | ::-webkit-file-upload-button { 241 | -webkit-appearance: button; 242 | font: inherit; 243 | } 244 | * { 245 | box-sizing: inherit; 246 | } 247 | *:before { 248 | box-sizing: inherit; 249 | } 250 | *:after { 251 | box-sizing: inherit; 252 | } 253 | h2 { 254 | margin-left: 0; 255 | margin-right: 0; 256 | margin-top: 0; 257 | padding-bottom: 0; 258 | padding-left: 0; 259 | padding-right: 0; 260 | padding-top: 0; 261 | margin-bottom: 1.45rem; 262 | color: inherit; 263 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, 264 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 265 | font-weight: bold; 266 | text-rendering: optimizeLegibility; 267 | font-size: 1.62671rem; 268 | line-height: 1.1; 269 | } 270 | h3 { 271 | margin-left: 0; 272 | margin-right: 0; 273 | margin-top: 0; 274 | padding-bottom: 0; 275 | padding-left: 0; 276 | padding-right: 0; 277 | padding-top: 0; 278 | margin-bottom: 1.45rem; 279 | color: inherit; 280 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, 281 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 282 | font-weight: bold; 283 | text-rendering: optimizeLegibility; 284 | font-size: 1.38316rem; 285 | line-height: 1.1; 286 | } 287 | h4 { 288 | margin-left: 0; 289 | margin-right: 0; 290 | margin-top: 0; 291 | padding-bottom: 0; 292 | padding-left: 0; 293 | padding-right: 0; 294 | padding-top: 0; 295 | margin-bottom: 1.45rem; 296 | color: inherit; 297 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, 298 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 299 | font-weight: bold; 300 | text-rendering: optimizeLegibility; 301 | font-size: 1rem; 302 | line-height: 1.1; 303 | } 304 | h5 { 305 | margin-left: 0; 306 | margin-right: 0; 307 | margin-top: 0; 308 | padding-bottom: 0; 309 | padding-left: 0; 310 | padding-right: 0; 311 | padding-top: 0; 312 | margin-bottom: 1.45rem; 313 | color: inherit; 314 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, 315 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 316 | font-weight: bold; 317 | text-rendering: optimizeLegibility; 318 | font-size: 0.85028rem; 319 | line-height: 1.1; 320 | } 321 | h6 { 322 | margin-left: 0; 323 | margin-right: 0; 324 | margin-top: 0; 325 | padding-bottom: 0; 326 | padding-left: 0; 327 | padding-right: 0; 328 | padding-top: 0; 329 | margin-bottom: 1.45rem; 330 | color: inherit; 331 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, 332 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 333 | font-weight: bold; 334 | text-rendering: optimizeLegibility; 335 | font-size: 0.78405rem; 336 | line-height: 1.1; 337 | } 338 | hgroup { 339 | margin-left: 0; 340 | margin-right: 0; 341 | margin-top: 0; 342 | padding-bottom: 0; 343 | padding-left: 0; 344 | padding-right: 0; 345 | padding-top: 0; 346 | margin-bottom: 1.45rem; 347 | } 348 | ul { 349 | margin-left: 1.45rem; 350 | margin-right: 0; 351 | margin-top: 0; 352 | padding-bottom: 0; 353 | padding-left: 0; 354 | padding-right: 0; 355 | padding-top: 0; 356 | margin-bottom: 1.45rem; 357 | list-style-position: outside; 358 | list-style-image: none; 359 | } 360 | ol { 361 | margin-left: 1.45rem; 362 | margin-right: 0; 363 | margin-top: 0; 364 | padding-bottom: 0; 365 | padding-left: 0; 366 | padding-right: 0; 367 | padding-top: 0; 368 | margin-bottom: 1.45rem; 369 | list-style-position: outside; 370 | list-style-image: none; 371 | } 372 | dl { 373 | margin-left: 0; 374 | margin-right: 0; 375 | margin-top: 0; 376 | padding-bottom: 0; 377 | padding-left: 0; 378 | padding-right: 0; 379 | padding-top: 0; 380 | margin-bottom: 1.45rem; 381 | } 382 | dd { 383 | margin-left: 0; 384 | margin-right: 0; 385 | margin-top: 0; 386 | padding-bottom: 0; 387 | padding-left: 0; 388 | padding-right: 0; 389 | padding-top: 0; 390 | margin-bottom: 1.45rem; 391 | } 392 | p { 393 | margin-left: 0; 394 | margin-right: 0; 395 | margin-top: 0; 396 | padding-bottom: 0; 397 | padding-left: 0; 398 | padding-right: 0; 399 | padding-top: 0; 400 | margin-bottom: 1.45rem; 401 | } 402 | pre { 403 | margin-left: 0; 404 | margin-right: 0; 405 | margin-top: 0; 406 | margin-bottom: 1.45rem; 407 | font-size: 0.85rem; 408 | line-height: 1.42; 409 | background: hsla(0, 0%, 0%, 0.04); 410 | border-radius: 3px; 411 | overflow: auto; 412 | word-wrap: normal; 413 | padding: 1.45rem; 414 | } 415 | table { 416 | margin-left: 0; 417 | margin-right: 0; 418 | margin-top: 0; 419 | padding-bottom: 0; 420 | padding-left: 0; 421 | padding-right: 0; 422 | padding-top: 0; 423 | margin-bottom: 1.45rem; 424 | font-size: 1rem; 425 | line-height: 1.45rem; 426 | border-collapse: collapse; 427 | width: 100%; 428 | } 429 | blockquote { 430 | margin-left: 1.45rem; 431 | margin-right: 1.45rem; 432 | margin-top: 0; 433 | padding-bottom: 0; 434 | padding-left: 0; 435 | padding-right: 0; 436 | padding-top: 0; 437 | margin-bottom: 1.45rem; 438 | } 439 | form { 440 | margin-left: 0; 441 | margin-right: 0; 442 | margin-top: 0; 443 | padding-bottom: 0; 444 | padding-left: 0; 445 | padding-right: 0; 446 | padding-top: 0; 447 | margin-bottom: 1.45rem; 448 | } 449 | noscript { 450 | margin-left: 0; 451 | margin-right: 0; 452 | margin-top: 0; 453 | padding-bottom: 0; 454 | padding-left: 0; 455 | padding-right: 0; 456 | padding-top: 0; 457 | margin-bottom: 1.45rem; 458 | } 459 | iframe { 460 | margin-left: 0; 461 | margin-right: 0; 462 | margin-top: 0; 463 | padding-bottom: 0; 464 | padding-left: 0; 465 | padding-right: 0; 466 | padding-top: 0; 467 | margin-bottom: 1.45rem; 468 | } 469 | address { 470 | margin-left: 0; 471 | margin-right: 0; 472 | margin-top: 0; 473 | padding-bottom: 0; 474 | padding-left: 0; 475 | padding-right: 0; 476 | padding-top: 0; 477 | margin-bottom: 1.45rem; 478 | } 479 | b { 480 | font-weight: bold; 481 | } 482 | strong { 483 | font-weight: bold; 484 | } 485 | dt { 486 | font-weight: bold; 487 | } 488 | th { 489 | font-weight: bold; 490 | } 491 | li { 492 | margin-bottom: calc(1.45rem / 2); 493 | } 494 | ol li { 495 | padding-left: 0; 496 | } 497 | ul li { 498 | padding-left: 0; 499 | } 500 | li > ol { 501 | margin-left: 1.45rem; 502 | margin-bottom: calc(1.45rem / 2); 503 | margin-top: calc(1.45rem / 2); 504 | } 505 | li > ul { 506 | margin-left: 1.45rem; 507 | margin-bottom: calc(1.45rem / 2); 508 | margin-top: calc(1.45rem / 2); 509 | } 510 | blockquote *:last-child { 511 | margin-bottom: 0; 512 | } 513 | li *:last-child { 514 | margin-bottom: 0; 515 | } 516 | p *:last-child { 517 | margin-bottom: 0; 518 | } 519 | li > p { 520 | margin-bottom: calc(1.45rem / 2); 521 | } 522 | code { 523 | font-size: 0.85rem; 524 | line-height: 1.45rem; 525 | } 526 | kbd { 527 | font-size: 0.85rem; 528 | line-height: 1.45rem; 529 | } 530 | samp { 531 | font-size: 0.85rem; 532 | line-height: 1.45rem; 533 | } 534 | abbr { 535 | border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5); 536 | cursor: help; 537 | } 538 | acronym { 539 | border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5); 540 | cursor: help; 541 | } 542 | thead { 543 | text-align: left; 544 | } 545 | td, 546 | th { 547 | text-align: left; 548 | border-bottom: 1px solid hsla(0, 0%, 0%, 0.12); 549 | font-feature-settings: "tnum"; 550 | -moz-font-feature-settings: "tnum"; 551 | -ms-font-feature-settings: "tnum"; 552 | -webkit-font-feature-settings: "tnum"; 553 | padding-left: 0.96667rem; 554 | padding-right: 0.96667rem; 555 | padding-top: 0.725rem; 556 | padding-bottom: calc(0.725rem - 1px); 557 | } 558 | th:first-child, 559 | td:first-child { 560 | padding-left: 0; 561 | } 562 | th:last-child, 563 | td:last-child { 564 | padding-right: 0; 565 | } 566 | tt, 567 | code { 568 | background-color: hsla(0, 0%, 0%, 0.04); 569 | border-radius: 3px; 570 | font-family: "SFMono-Regular", Consolas, "Roboto Mono", "Droid Sans Mono", 571 | "Liberation Mono", Menlo, Courier, monospace; 572 | padding: 0; 573 | padding-top: 0.2em; 574 | padding-bottom: 0.2em; 575 | } 576 | pre code { 577 | background: none; 578 | line-height: 1.42; 579 | } 580 | code:before, 581 | code:after, 582 | tt:before, 583 | tt:after { 584 | letter-spacing: -0.2em; 585 | content: " "; 586 | } 587 | pre code:before, 588 | pre code:after, 589 | pre tt:before, 590 | pre tt:after { 591 | content: ""; 592 | } 593 | @media only screen and (max-width: 480px) { 594 | html { 595 | font-size: 100%; 596 | } 597 | } 598 | --------------------------------------------------------------------------------