An extension of the gatsby-starter-default
repository, made to get up and running quicker with standard marketing microsites.
-
Create a Gatsby site.
Use the Gatsby CLI to create a new site, specifying the emotion starter.
# create a new Gatsby site using this starter gatsby new my-default-starter https://github.com/jackoliver/gatsby-starter-emotion-theme
-
Start developing.
Navigate into your new siteβs directory and start it up.
cd my-default-starter/ gatsby develop
-
Open the source code and start editing!
Your site is now running at
http://localhost:8000
!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.Open the
my-default-starter
directory in your code editor of choice and editsrc/pages/index.js
. Save your changes and the browser will update in real time!
- gatsby-plugin-emotion
- gatsby-alias-imports
- @emotion/core
- @emotion/styled
- emotion-reset
- emotion-theming
By using gatsby-alias-imports
, we can define alias paths to the modules and components we require, making it easier to import and re-use code across multiple pages and layouts.
For example, this:
import Layout from "../components/layout"
import Image from "../components/image"
import SEO from "../components/seo"
turns into:
import { Default as Layout } from 'layouts'
import { Image, SEO } from 'components'
- Multiple layouts can be created very easily on a per-page level.
- Components can be imported in one line.
- Modules can also be imported in one line.
The full folder structure looks like this:
.
βββ node_modules
βββ src
β βββ components
β βββ config
β βββ images
β βββ layouts
β βββ modules
β βββ pages
βββ .gitignore
βββ .prettierrc
βββ gatsby-browser.js
βββ gatsby-config.js
βββ gatsby-node.js
βββ gatsby-ssr.js
βββ LICENSE
βββ package-lock.json
βββ package.json
βββ README.md
Looking for more guidance? Full documentation for Gatsby lives on the website. Here are some places to start:
-
For most developers, we recommend starting with the in-depth tutorial for creating a site with Gatsby. It starts with zero assumptions about your level of ability and walks through every step of the process.
-
To dive straight into code samples, head to the documentation. In particular, check out the Guides, API Reference, and Advanced Tutorials sections in the sidebar.