web-starter-kit

A simple starting-point application utilizing the newest versions of webpack,babel, react, and a whole lot more.

  • Isomorphic: Render pages on the server and in the client. Fully staticcontent can be pre-rendered into files to increase server-side performance.
  • Hot Reload: Increase development productivity with hot reload.
  • Newest Libraries: Using the newest versions of webpack, babel, react, andmore

Getting Started

Here are some pointers if you want to use this project as the starting pointfor a project of your own. The first thing you’ll want to do is fetch theproject:

git clone git@github.com:bmatcuk/web-starter-kit.git my-project
cd my-project

Command Line

Start hot reloading development server using browsersync with:

npm run start:dev

Run a build for production:

npm run build

Run a production server (using express)… you’ll need to build first:

npm start

Making Changes

All of the files you’ll want to change are in the src directory. The libdirectory contains some utility code for building and running an expressserver.

Configuration

All of the configuration options can be found in the config.json file in theroot of the project.

  • publicPath: If your site will be hosted in a subdirectory (such ashttp://example.com/subdirectory) then you’ll want to set the publicPath tothe subdirectory (/subdirectory in this example). If your site will behosted at the root (like http://example.com/) then you should set publicPathto /.
  • staticPaths: Static paths to crawl (seeBuilding Static Files below). If you are going tohost under a subdirectory (see publicPath), your staticPaths will include thissubdirectory.

Building Static Files

By default, when you run npm run build, the build will attempt to pre-renderany files that can be pre-rendered. It does this by starting up an expressserver and visiting every URL mentioned in the staticPaths variable inconfig.json. For each file rendered this way, the script parses the HTML tofind new relative paths to crawl. Any path ending in a / will be created as asubdirectory with an index.html file. Any path that does not contain a fileextension will automatically append a .html.