0.0.1 • Published 9 years ago

generator-como v0.0.1

Weekly downloads
4
License
-
Repository
github
Last release
9 years ago

Como generator

Yeoman generator for Como - lets you quickly set up a project with sensible defaults and best practices.

Usage

For step-by-step instructions on using Yeoman, see this tutorial.

Install yo, grunt-cli, bower and generator-como:

npm install -g grunt-cli bower yo generator-como

Make a new directory, and cd into it:

mkdir my-new-project && cd $_

Generators

Available generators:

Controller

Generates a controller in app/scripts/controllers.

Example:

yo como:controller user

Produces app/scripts/controllers/user.js:

angular.module('myMod').controller('UserCtrl', function ($scope) {
  // ...
});

Directive

Generates a directive in app/scripts/directives.

Example:

yo como:directive myDirective

Produces app/scripts/directives/myDirective.js:

angular.module('myMod').directive('myDirective', function () {
  return {
    template: '<div></div>',
    restrict: 'E',
    link: function postLink(scope, element, attrs) {
      element.text('this is the myDirective directive');
    }
  };
});

Filter

Generates a filter in app/scripts/filters.

Example:

yo como:filter myFilter

Produces app/scripts/filters/myFilter.js:

angular.module('myMod').filter('myFilter', function () {
  return function (input) {
    return 'myFilter filter:' + input;
  };
});

View

Generates an HTML view file in app/views.

Example:

yo como:view user

Produces app/views/user.html:

<p>This is the user view</p>

Service

Generates an AngularJS service.

Example:

yo como:service myService

Produces app/scripts/services/myService.js:

angular.module('myMod').service('myService', function () {
  // ...
});

You can also do yo como:factory, yo como:provider, yo como:value, and yo como:constant for other types of services.

Decorator

Generates an AngularJS service decorator.

Example:

yo como:decorator serviceName

Produces app/scripts/decorators/serviceNameDecorator.js:

angular.module('myMod').config(function ($provide) {
    $provide.decorator('serviceName', function ($delegate) {
      // ...
      return $delegate;
    });
  });