samora / ng-launchpad

Opinionated kickstarter for Angular JS projects. Inspired by ngBoilerplate.
www.samora.me/ng-launchpad
45 stars 5 forks source link

ng-launchpad

Opinionated kickstarter for AngularJS projects. Inspired by ngBoilerplate.

Quick Start

Install Node.js and Git and then:

$ git clone git://github.com/samora/ng-launchpad
$ cd ng-launchpad
$ npm install -g gulp bower
$ npm install
$ gulp

Visit localhost:8000 in your browser.

Enjoy!

Purpose

ng-launchpad, like ngBoilerplate, is meant to make life easy by providing a basic framework with which to kickstart AngularJS projects.

However, ng-launchpad is simpler and differs in a few ways:

ng-launchpad is a simpler than ngBoilerplate on purpose, yet keeps the same ideas.

Features

Components

The following have already been added because I believe they are the bare minimum components you may need. Add or remove according to your requirements.

Learn

Overall Directory Structure

At a high level, the structure looks roughly like this:

ng-launchpad/
  |- src/
  |  |- common/
  |  |  |- <shared modules>
  |  |- img/
  |  |  |- <images>
  |  |- less/
  |  |  |- main.less
  |  |  |- variables.less
  |  |- modules/
  |  |  |- <app modules>
  |  |- index.jade
  |- vendor/
  |- .bowerrc
  |- bower.json
  |- build.config.js
  |- Gulpfile.js
  |- karma.conf.js
  |- package.json
  |- protractor.conf.js

File naming conventions for src/common and src/modules

Installation

The Quick Start should be enough to get most people started. However here are more details:

Preferrably you can use Git to download ng-launchpad and start hacking.

$ git clone git://github.com/samora/ng-launchpad <directory>
$ cd <directory>

Or you can download a zipped copy.

Then, make sure you have gulp and bower installed globally. You might have to prefix the command with sudo in Linux if you don't have appropriate permissions.

$ npm install -g gulp bower

Finally, install dependencies from root folder:

$ npm install

bower install will be run automatically after npm install.

To make sure everything is working:

$ gulp watch

Note: On first run this might take a while as Protractor's webdriver must be downloaded and installed.

Build System: Managing Tasks with gulp.js

gulp.js is used to manage all tasks. The best way to learn how the tasks work is by familiarizing yourself with gulp.js and reading through the documented build script, Gulpfile.js. But you don't need to do that to be very productive with ng-launchpad.

Below are the important tasks that come pre-configured with ng-launchpad. All tasks should be run in a terminal or command prompt from the root of your app with gulp.

Example:

$ gulp compile

Some tasks, notably those which run e2e tests with Protractor, may take a while to complete on first run. This is because the webdriver needs to be downloaded and installed first.

You can change the output production directory by changing the productionDir variable in Gulpfile.js. This will rename the clean:_public task to clean:<productionDir>.

Development server & Live Reload

ng-launchpad's local server can be found at http://localhost:8000 or http://127.0.0.1:8000.

ng-launchpad also includes Live Reload, so you no longer have to refresh your page after making changes. You need a Live Reload brower plugin for this:

When you load your page, click the Live Reload icon in your toolbar and everything should work magically.

If you'd prefer to not install a browser extension, then you must add the following to the end of the body tag in index.jade:

script(src='http://localhost:35729/livereload.js')

Todo

After getting some feedback from the community these are the things I want to put on the todo list:

I haven't tackled any of these yet. So anyone is welcome to take a crack at it.

Tip: I think it will be quite easy to add CoffeeScript support.

Contributing

A good starting point, but surely improvements can be made. Feel free to contact me. Better still, submit a pull request.