1.0.6 • Published 10 years ago

yeoman-blueprints v1.0.6

Weekly downloads
5
License
MIT
Repository
github
Last release
10 years ago

yeoman-blueprints

For a working example look at generator-angular-blueprints.

Extends Yeoman's NamedBase to allow to your generator to use overridable templates. By using these extended methods yeoman will automatically check for locally created template under first ./blueprints and then ./node_modules before falling back to the global templates in the generator.

YOUR GENERATORS MUST BE UNDER generators/
npm install --save yeoman-blueprints

the generated folder structure for overriding blueprint

root
|-- blueprints
|---- templates
|------ blueprint.json
|------ controller
ā””-------- template.js

Methods

blueprints.copyTpl

// 'controller' - points to generator you want to use in this case located under generators/controller/
// 'js'         - the file type to be created
// values       - an object of values to be made available to template
this.copyTpl('controller', 'js', './destination/my-controller.js', values);

blueprints.copy

// 'controller' - points to generator you want to use in this case located under generators/controller/
// 'js'         - the file type to be created
this.copy('view', 'html', './destination/my-view.html');

Example:

var blueprint = require('yeoman-blueprints');

module.exports = blueprints.NamedBase.extend({
  writing: function writing() {
    var destDir = './client/app/views/' + this.name + '.controller.js';
             
    // Set the template values
    var values = {value1: 'HelloWorld'}
           
    // Create the template
    this.copyTpl('controller', 'js', destDir, values);
  }
});
1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago