Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deebloo/yeoman-blueprints
Extends Yeoman's NamedBase to allow to your generator to use overridable templates
https://github.com/deebloo/yeoman-blueprints
Last synced: 15 days ago
JSON representation
Extends Yeoman's NamedBase to allow to your generator to use overridable templates
- Host: GitHub
- URL: https://github.com/deebloo/yeoman-blueprints
- Owner: deebloo
- License: mit
- Created: 2015-05-02T21:37:33.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T08:43:35.000Z (about 1 year ago)
- Last Synced: 2024-12-01T13:27:15.079Z (about 1 month ago)
- Language: JavaScript
- Size: 3 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yeoman-blueprints
For a working example look at [generator-angular-blueprints](https://github.com/deebloo/generator-angular-blueprint).
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
```js
// '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
```js
// '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:
```js
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);
}
});
```