• Stars
    star
    386
  • Rank 111,213 (Top 3 %)
  • Language
    TypeScript
  • Created over 7 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Gatsby 2.0 starter with typescript and many cools dev tools

Gatsby 2.0 starter

XO code style Build Status Build status Code Climate Test Coverage

Demo: https://fabien0102-gatsby-starter.netlify.com/

Storybook: https://fabien0102-gatsby-starter.netlify.com/docs/

Gatsby 2.0 starter for generate awesome static website working with a nice env development.

Warning

This starter is currently in wip (see progression to #What's inside session).

Getting started

Install this starter (assuming Gatsby is installed) by running from your CLI:

$ gatsby new my-website https://github.com/fabien0102/gatsby-starter

Run npm start (or press F5 if you are on VSCode) to hot-serve your website on http://localhost:8000.

Run npm run build to create static site ready to host (/public)

What's inside?

Files structure

 .
 β”œβ”€β”€ data                          // website data (included into graphQL)
 β”‚   β”œβ”€β”€ author.json               // list of blog authors
 β”‚   β”œβ”€β”€ avatars                   // authors avatars
 β”‚   └── blog                      // all blog data (posts, images)
 β”œβ”€β”€ gatsby-config.js              // gatsby configuration
 β”œβ”€β”€ gatsby-node.js                // gatsby node hooks
 β”œβ”€β”€ generators                    // generators (`npm run generate`)
 β”‚   β”œβ”€β”€ blog-post-generator.js    // `blog post` generator
 β”‚   β”œβ”€β”€ component-generator.js    // `component` generator
 β”‚   β”œβ”€β”€ page-generator.js         // `page` generator
 β”‚   β”œβ”€β”€ plopfile.js               // generators entry
 β”‚   β”œβ”€β”€ templates                 // all templates (handlebar notation)
 β”‚   └── utils.js                  // utils scripts for generators
 β”œβ”€β”€ package.json
 β”œβ”€β”€ public                        // output folder (in .gitignore)
 β”œβ”€β”€ README.md                     // this file
 β”œβ”€β”€ src                           // sources
 β”‚   β”œβ”€β”€ components                // all react components
 β”‚   β”œβ”€β”€ css                       // styles
 β”‚   β”œβ”€β”€ declarations.d.ts         // declarations for no typescript modules/files
 β”‚   β”œβ”€β”€ graphql-types.d.ts        // graphql types (`npm run graphql-types`)
 β”‚   β”œβ”€β”€ html.tsx                  // main html (required)
 β”‚   β”œβ”€β”€ layouts                   // layouts
 β”‚   β”‚   └── default.tsx           // default layout (required)
 β”‚   β”œβ”€β”€ pages                     // all pages
 β”‚   └── templates                 // all templates (used for procedural page creation, see `gatsby-node.js`)
 β”œβ”€β”€ tools                         // miscs tools for dev
 β”‚   └── update-post-date.js       // update post date hook
 β”œβ”€β”€ tsconfig.json                 // typescript configuration
 β”œβ”€β”€ tslint.json                   // tslint configuration
 └── package-lock.json             // npm lock file

Plop generators - npm run generate

To avoid any boring copy/paste, this starter-kit have many generators to permit simple bootstrap of current file pattern (eg. components/pages/blog posts). e.g. to add a new blog post first add the authors to data/authors.json and add authors' images to the data/avatars folder. Next execute 'npm run generate' and select 'Blog post'. Follow the prompts for a new post. Each blog post requires an image be added to the /data/blog/ folder prior to running 'gatsby develop'.

You can add/delete/modify any generators into /generators folder.

Be lazy and have fun!