Git Product home page Git Product logo

generator-yo-angular's Introduction

A Yeoman generator for AngularJs project

This is a yeoman generator for AngularJs project.

It takes advantage of the gulp build tool and makes use of bower and npm for dependency management.

Fork me on GitHub


GENERATED DIRECTORY STRUCTURE

assets/
  app/
    main/
      content.html
      mainCtrl.js
    app.js
    initializer.js
    route.js
  common/
    controllers/
      headerCtrl.js
      directives/
    layout/
      footer.html
      header.html
      layout.html
    models/
    partials/
    services/
  css/
    includes/
      _main.scss
    app.scss
  images/
  vendor/
    plugins.js
  404.html
  apple-touch-icon-precomposed.png
  crossdomain.xml
  favicon.ico
  humans.txt
  index.html
  robots.txt
bower_components/    
node_modules/
.bowerrc
.editorconfig
.gitignore
.jshintrc
bower.json
gulpfile.js
package.json

FEATURES

  • follows the project structure for angular seed
  • using HTML5 boilerplate and bootstrap 3
  • using 'gulp' command to develop app in development environment
  • using 'gulp production' command to release app in production environment
  • after run 'gulp production' command, all app files are compiled into release folder
  • a static server is run at port 3000 with livereload support

Prerequisites


Generators

Available generators:

  • yo-angular
  • yo-angular:page
  • yo-angular:directive
  • yo-angular:model
  • yo-angular:controller
  • yo-angular:service

Note: Generators are to be run from the root directory of your app.

App

Sets up a new AngularJS app, generating all the boilerplate you need to get started.

Example:

yo yo-angular

Page

Generates a controller and view in assets/app/.

Example:

yo yo-angular:page

Produces assets/app/user/userCtrl.js:

"use strict";

angular.module('ng.controller').controller('userCtrl' ,
  function($scope) {

  }
);

Produces assets/app/user/content.html:

<div>
  user
</div>

Directive

Generates a directive in assets/common/directives/.

Example:

yo yo-angular:directive

Produces assets/common/directives/user.js:

"use strict";

angular.module('ng.directive').directive('user', [function () {
  return {
    restrict: 'A',
    link: function (scope) {

    },
    controller: function($scope){

    }
  };
}]);

Model

Generates a model in assets/common/models/.

Example:

yo yo-angular:model

Produces assets/common/models/userModel.js:

"use strict";

angular.module('ng.model').factory('userModel', ['$resource', function($resource) {
  function userModel() {
    this.url = '';
    return $resource(this.url, {id: '@id'},{
      'get':    {method:'GET','url':this.url},
      'getAll':  {method:'GET', isArray:true,'url':this.url},
      'update': {method:'PUT','url':this.url},
      'remove': {method:'DELETE','url':this.url}
    });
  }
  return new userModel();
}]);

Controller

Generates a controller in assets/common/controllers/.

Example:

yo yo-angular:controller

Produces assets/common/controllers/userCtrl.js:

"use strict";

angular.module('ng.controller').controller('userCtrl' ,
  function($scope) {

  }
);

Service

Generates a service in assets/common/services/.

Example:

yo yo-angular:service

Produces assets/common/services/userService.js:

"use strict";

angular.module('ng.service').controller('userService' ,
  function userService() {

  }
  return new userService();
);

USAGE

  1. npm install -g bob76828/generator-yo-angular

  2. mkdir myApp && cd myApp && yo yo-angular

  3. gulp

  4. start developing


Support

For questions and issues: https://github.com/bob76828/generator-yo-angular/issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.