This is an example JavaScript application which uses Backbone and Requirejs. It uses Jam for package management and has a set of tests written with Jasmine. It uses Grunt (0.4) as a build tool.
It uses the Geolocation API and the Instagram API to show a set of nearby photos.
You will need Node.js and NPM installed. Visit the Node.js website for instructions for your OS.
- Clone the repo:
$ git clone [email protected]:mrappleton/localgram.git
- Install build dependencies (these are listed in
package.json
underdevDependencies
):
$ npm install
- Install front end dependencies:
$ jam install
- Rename
js/constants.js.example
tojs/constants.js
:
$ mv js/constants.js.example js/constants.js
-
Visit Instagram and register an API client. Copy your
client_id
intojs/contants.js
. -
Run the development server and visit http://localhost:8000/ in a browser.
$ grunt connect:dev
This project includes a number of Grunt build tasks:
-
grunt jshint
: Runs all JavaScript against JSHint. -
grunt spec
: Runs Jasmine tests in a headless PhantomJS instance. -
grunt spec-server
builds the Jasmine spec runner file and starts a server to view it in a browser. Visit http://localhost:1337/_SpecRunner.html for easier test debugging
The application is split across may different files. THey can be built together into a single file suitable for production deployment by running:
$ jam compile build/app.js
This run the r.js optimizer and put the compiled output into
build/app.js
.