Package Exports
- coz
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (coz) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
coz
Flexible generator, which makes your project clean and maintainable.
Table of Contents
About coz
What's this?
The basic idea of coz is that creating files from files.
Write a meta file called [.bud file][#spec-bud-spec] and run coz generates the magic.
What for?
Automation.
No more meta programming.
Why this?
- Because it's fast.
coz is lightweight engine and do nothing but rendering.
- Because it's extensible.
coz is an unopinionated provides ways to customize.
- Because it's flexible.
coz is attentive, like handling array or async operations, and guess a lot unless otherwise specified.
Getting started
Requirements
Install
$ npm install coz -gSimple example
Step01 Configure bud file
module.exports = {
force: true,
mode: '444',
data: {
entities: [
{name: 'User'},
{name: 'Machine'},
]
}
}Step02 Prepare template
{{#each entities}}
/** Entity for {{snakecase name}} */
module.exports = function {{pascalcase name}}Entity(){
};
{{/each}}
Step03 Render file
bash $ coz render .*.bud
Specifications
Bud file specification.
A bud contains file meta data like witch template to use, where to render it, what permission to give, and so on.
You can specify bud data by writing .bud file, which is actually a javascript file and could be written nodejs format.
module.exports = {
path: 'my_file.txt',
tmpl: '.my_file.txt.hbs',
data: require('./.my_data')
}And bud could be an array like:
module.exports = [
{path: 'my_file.txt', /*...*/},
{path: 'my_other_file.txt', /*...*/},
]Or an async function.
module.exports = function(callback){
myAsync(function(data){
var error = null;
callback(err, data);
});
}Supported properties
| Name | Type | Description |
|---|---|---|
| engine | string|object | Template compile function or name of function |
| cwd | string | Working directory path |
| data | object | Data to template render with |
| done | boolean | Done to writeout or not |
| mkdirp | boolean | Make parent directories if needed |
| setup | object | Properties to set engine |
| force | boolean | Should overwrite file when already exists, or not |
| mode | string|number | File permission |
| path | string | Destination file path. If not provided, guess from bud file path |
| src | string | Bud source file path |
| tmpl | string|function | Template file path or registered template name or template function |
Links
Documents
Reports
License
This software is released under the MIT License.
About this project
Author
Donation
Support this project and others by okunishinishi via gittip.

