Skip to content

A boilerplate starter for full stack JS development. Backbone, Marionette, Requirejs, Less, Handlebars, Google Analytics

License

Notifications You must be signed in to change notification settings

at0g/bens-boilerplate

Repository files navigation

bens-boilerplate

A boilerplate starter for full stack JS development using Node/Express, Grunt, Backbone, Marionette, Requirejs, Less, Handlebars & Google Analytics.

Getting started

  1. Clone/fork this repository
  2. npm install
  3. bower install
  4. grunt

Working with the boilerplate

The default grunt task sets up a development server on port 8080 and watches for changes to source code in the client/js directory. Changed files are linted (jshint) and then copied to the public directory (the web root) verbatim.

The "grunt build" task runs the code from client/js via the requirejs optimiser and places the output in the public directory to be served by express.

Note that the public directory is periodically cleaned. Eg. Don't put source code in here, or it will be overwritten/deleted.

Project layout

  • client Contains client side source code (.js, .less etc)
    • vendor Contains bower components. Mounted by express as /vendor
  • public The web root where files are served over http. Note that all content in this directory is/should be generated by the build script or similar.
  • server The code to run the nodejs/express dev server.
  • templates Shared (client and server) templates directory. By default uses handlebars templates. Mounted by express as /templates.

Configuration

There is a config.json file that contains settings for each environment, such as the google analytics tracking code id and the base path to static assets. The assetPath setting is best set to '' (nothing) for development but can be used to serve static files from a CDN or other remote host in staging/production environments.

Google Analytics

If you want to test google analytics locally, it's best to use 127.0.0.1 (or another resolvable hostname/ip) over localhost, otherwise tracking events will not be sent (hostname mismatch). Likewise, the dev analytics account needs to be set to the same hostname.

About

A boilerplate starter for full stack JS development. Backbone, Marionette, Requirejs, Less, Handlebars, Google Analytics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published