generator-nglight
v0.1.9
Published
--- A lightweight Angular yeoman generator.
Downloads
13
Readme
generator-nglight
A lightweight Angular yeoman generator.
Installation
Before you begin
- Make sure you have npm installed
- Make sure you have yeoman installed http://yeoman.io
npm install -g yo
- Make sure you have grunt-cli installed globally
npm install -g grunt-cli
Getting started
- Install the generator via npm
npm install -g generator-nglight
- Next, create a directory for your project to live in.
- After moving to your newly created directory, run the generator with the following command
yo nglight <appname>
This will generate your new app! You will be prompted for a test framework. You can choose either jasmine or mocha.
- Now run
npm install
andbower install
to download dependencies - And walla! you have a fully operational battle station... I mean angular application!
Usage
Running your app
In order to build and run your application, run the following command from the root of your project.
grunt serve
This will build your app into a .tmp/public directory, start up a simple server, and watch for file changes.
Building your app
In order to build your app for production, run the following command from the root of your project.
grunt buildProd
This will minify your Javascript/Stylesheets and build your app into www/. You can test your production code locally by changing the location of the app.js server to www.
TODO: Add subtask for serve which serves from production build folder.
Testing your app
In order to test your app, run npm test
. This will start the karma test runner. Note by default karma will watch for file changes and rerun your tests every time you save a file. You can disable this in the karma.conf
file.
To run your unit tests a single time, use:
grunt test
Using Sub-generators
ngLight comes built in with several sub-generators which adhere to the Angular 1.x style guide. This is to enforce modular design.
Modules
To generate a new module, use the following command:
yo nglight:module <module name> <directory>
This generates a new sub module (under the main project module) in assets/app//.module.js. ** BE SURE TO ADD THIS MODULE AS A DEPENDENCY TO THE MAIN MODULE **
Routers
To generate a new router, use the following command:
yo nglight:router <module name> <directory>
This generates a new sub router in assets/app//.routes.js.
Controllers
To generate a new controller, use the following command:
yo nglight:controller <moduleName> <directory> <controllerName>
This generates a new controller in assets/app//.controller.js.
Services
To generate a new service, use the following command:
yo nglight:service <moduleName> <directory> <serviceName>
This generates a new service in assets/app//.service.js.
Directive
To generate a new directive, use the following command:
yo nglight:directive <moduleName> <directory> <directiveName>
This generates a new service in assets/app//.directive.js.
Deploying
TODO