https://github.com/tabone/yofz
A node module aimed to ease the creation of directories and templates inside Yeoman.
https://github.com/tabone/yofz
Last synced: 5 days ago
JSON representation
A node module aimed to ease the creation of directories and templates inside Yeoman.
- Host: GitHub
- URL: https://github.com/tabone/yofz
- Owner: tabone
- License: mit
- Created: 2015-03-01T22:14:37.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-03-21T09:15:05.000Z (over 11 years ago)
- Last Synced: 2024-03-16T04:10:51.291Z (over 2 years ago)
- Language: JavaScript
- Size: 125 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Yofz - Yeoman File System Helper
This is a node module which ease the process for a developer to create the directories and templates needed for a Yeoman Generator. This module enables you to create a hierarchical structure of `Directories` and Templates (`Plates`).
## Installation
npm install --save yofz
## Coding
Once installed require it. This will create a new instance of `Yofz`
var Yofz = require('Yofz')
A `Yofz` instance will require two things: A root directory and a reference to the Yeoman generator being used. This can either be done when requiring the module:
module.exports = generator.Base.extend( {
initializing: function() {
require('Yofz')(rootDir, this)
}
});
Or by using the `.setGenerator(..)` and `.setRoot(..)` methods:
var Yofz = require('Yofz')
Yofz.setGenerator(this)
Yofz.setRoot(rootDir)
### Creating Directories
var dir = Yofz.Directory(name[, opts])
| No. | Type | Description |
|-----|--------|----------------------------|
| 1 | String | The name of the directory. |
| 2 | JSON | Configuration. |
Inside the `Configuration` object one can enter the following:
| No. | Name | Type | Description |
|-----|----------|---------|----------------------------|
| 1 | children | Array or Asset | Child or children assets. |
| 2 | write | Boolean | True if the template file should be written, false otherwise. |
### Creating Templates
var index = Yofz.Plate(name[,opts])
| No. | Type | Description |
|-----|---------|---------------------------------------------------------------|
| 1 | String | The name of the template. |
| 2 | JSON | Configuration. |
Inside the `Configuration` object one can enter the following:
| No. | Name | Type | Description |
|-----|----------|---------|----------------------------|
| 1 | context | JSON | Template context object. |
| 2 | write | Boolean | True if the template file should be written, false otherwise. |
### Appending Files and Directories inside other Directories
var root = Yofz.Directory('root')
var dist = Yofz.Directory('dist')
var index = Yofz.Plate('index.js', { 'context': {'title': 'Yofz'}
, 'write': true
})
dist.contains(index)
root.contains(root)
### Build It
Yofz.build()