Skip to content

Instantly share code, notes, and snippets.

@djsiddz2
Last active May 16, 2017 11:16
Show Gist options
  • Save djsiddz2/6b5270b80bd1fc5602dfc4e56244629d to your computer and use it in GitHub Desktop.
Save djsiddz2/6b5270b80bd1fc5602dfc4e56244629d to your computer and use it in GitHub Desktop.
Creating AngularJS with Yo

When Installing for the first time

Install the following things: npm install -g grunt-cli bower yo generator-karma generator-angular

Creating AngularJS apps with Yeoman for separating from existing app.

  1. mkdir my-new-project && cd $_
  2. yo angular [app-name]
  3. Answer a few questions
    • Would you like to use Gulp instead of Grunt? N
    • Would you like to use Sass with compass? N
    • Would you like to include Bootstrap? N
    • Which modules would you like to include?
      • angular-animate
      • angular-aria
      • angular-cookies
      • anuglar-resource
      • angular-messages
      • angular-route
      • angular-santize
      • angular-touch
  • Overwrite package.json? overwrite
  1. Add bower components that are required from old bower.json to new bower.json
    • Verify the libraries to be added from application.js / app.js file as well. and bower install
  2. Create/update application.js file
    • Move the required routes, keep/remove modules as required.
    • If using $locationProvider.html5Mode(true); then add this line to app/index.html file: <base href="/">
  3. Add required files (files from previous projects: controllers, directives, services, templates, images)
    • controllers in app/scripts/controllers
    • templates in app/views
    • directives in app/scripts/directives
    • services in app/scripts/services
    • modules in app/scripts/??
    • images in app/images
  4. Fix routes
  5. Run grunt initially, there will be some javascript errors that will have to be fixed for the app to build and run. Fix all possible errors and once successful, move on to the next step. If you are left with only warnings and it is safe to go ahead, then use grunt --force.
  6. grunt serve

== this is for local development only ==

For running on production, do the following:

  1. Add things
  2. Add things
  3. Add things
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment