You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Taka Okunishi edited this page Jun 24, 2015
·
16 revisions
Overview
coz provides programmatic API.
This is usefull when you do not want to install coz globally.
Install coz locally
$ npm install coz --save-dev
Base usage.
This is an example to execute rendering via programmatic API.
#!/usr/bin/env
/** * run_rendering.js * This is a bud file for "examples/04-from-programmatic-api/run_rendering.js" */varcoz=require('coz');// Render .bud files.coz.render(['**/.*.bud'],function(err){console.log(err ? err : 'Done!');});
#!/usr/bin/env
/** * .exec-me.txt.bud * This is a bud file for "examples/04-exec-bud-itself" */module.exports={force: true,mode: '444',tmpl: 'This file is rendered from: ""',data: {from: __filename}};// If there is no parent, it means that this module is executed directory.// e.g., `node .exec-me.txt.bud`varmain=module.parent==null;if(!main){// Render this bud file.// `__filename` is Node.js reserved word and contains path of this file.require('coz').render(__filename);}