Skip to content

Latest commit

 

History

History
127 lines (80 loc) · 7.05 KB

README.md

File metadata and controls

127 lines (80 loc) · 7.05 KB

gatsby

Gatsby Simple Starter

This is a simple starter for Gatsby based on on the default Gatsby starter.

🔦 Uses in production

🔃 Comparison with the default Gatsby starter

  1. TypeScript is used for a better developer experience.

  2. ESLint and the AirBnB TypeScript style guide help you avoid, and fix, simple issues in your code.

  3. The default Gatsby formating tool, Prettier, has been removed in order to avoid conflicts with the ESLint + AirBnB TypeScript tools described above.

  4. Firebase Hosting is supported and configured for Gatsby from the start.

  5. Blog posts are implemented from the start via Gatsby dynamic pages, you can simply add any markdown file to the posts directory with the appropriate frontmatter.

🚀 Quick start

  1. Fork or clone this repository.

    Use the fork button on the Github repository, or clone the repo as follows:

    # Clone the repo
    git clone https://github.com/rickkln/gatsby-starter-simple.git my-new-site
  2. Navigate into the cloned folder.

    Navigate into your new site’s directory, install the libraries and start it up:

    cd my-new-site/
    npm install
    gatsby develop
  3. 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-new-site directory in your code editor of choice and edit src/pages/index.tsx. Save your changes and the browser will update in real time!

  4. Deploy your new site!

    Once you are ready to deploy your changes you can do so using Firebase, or your hosting provider of choice. If you choose to go with firebase you can use the default configuration in the project.

    Simply follow the instructions on the Firebase website to initialize and connect the firebase CLI.

    Once Firebase CLI is connected to your Firebase project you are ready to deploy:

    # To build the Gatsby site and deploy to Firebase hosting in one go
    npm run deploy

🧐 What's inside?

A quick look at the top-level files and directories you'll see in this project.

.
├── node_modules
├── src
├── .eslintrc.js
├── .gitignore
├── firebase.json
├── gatsby-config.js
├── gatsby-node.js
├── LICENSE.md
├── package-lock.json
├── package.json
├── README.md
└── tsconfig.json
  1. /node_modules: This directory contains all of the modules of code that your project depends on (npm packages) are automatically installed.

  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”.

  3. .eslintrc.js: This is a configuration file for ESLint. ESLint is a tool to help you avoid and fix simple issues in your code.

  4. .gitignore: This file tells git which files it should not track / not maintain a version history for.

  5. firebase.json: This is a configuration file that lists your Firebase project configuration. Learn more about this file in the Firebase docs.

  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 for more detail).

  7. gatsby-node.js: This file is where Gatsby expects to find any usage of the Gatsby Node APIs (if any). These allow customization/extension of default Gatsby settings affecting pieces of the site build process.

  8. LICENSE.md: Gatsby itself, along with the code for this starter are licensed under the MIT license.

  9. 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).

  10. 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.

  11. README.md: This text file, which contains useful reference information about your project.

  12. tsconfig.json: This is a configuration file for TypeScript. The tsconfig.json file specifies the root files and the compiler options required for the TypeScript compiler to compile the project. More details are available in the TypeScript docs.

🎓 Need some help with Gatsby?

While you're welcome to fork and use this code, as per the license below, I don't have time to help you fix issues. If you are looking for more guidance you can use the official documentation for Gatsby. Here are some useful places to start:

  • The official 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.

  • The Gatsby code samples. In particular, check out the Guides, API Reference, and Advanced Tutorials sections in the sidebar.

  • The documentation on the TypeScript Plugin. This is specifically useful if you are forking this project, as it uses TypeScript.

📝 License

The original code in this repo is licensed under the MIT License. For more information view the LICENSE file.