0.1.4 • Published 11 years ago
tmpltn v0.1.4
tmpltn
Super lightweight in-directory project scaffolding
Installation
npm -g install tmpltnExample Usage
1) Define a template file
templates/model.tmpltn.js
/**
* TmpltnName: Model
* TmpltnDescription: Generic scaffolding for a Model
*/
// TmpltnOutput: lib/models/{{ train:name }}-model.js
class {{capitalize:camel:name}} {
}
// TmpltnOutput: test/models/{{ train:name }}-model-spec.js
var expect = require('expect.js');
describe('Models::{{capitalize:camel:name}}', function() {
});2) Run tmpltn
tmpltn gen Model name=Person3) Profit
tmpltn creates files:
lib/models/person-model.js
class Person {
}test/models/person-model-spec.js
var expect = require('expect.js');
describe('Models::Person', function() {
});Using Tmpltn
ls
Lists available templates
tmpltn lsgen opts vars...
Generates template of given name using the variables provided.
Omit vars to see available variables for a given file.
tmpltn gen ModelPossible variables: nameYou may also overwrite the default output directory by specifying --output-path.
tmpltn gen --output-path customDir/ Model name="Bob"Template Files
The following tags are all valid:
TmpltnName- the name of the template, used fortmpltn lsTmpltnDescription- the description for the template, used fortmpltn lsTmpltnOutput- the default output path for the file
Variable Transfomation
The following transformers may be used. (Feel free to submit a PR to add more!)
Transformation may also be chained. eg. {{ capitalize:camel:name }}
- camel -
My Name->myName - capitalize -
myName->MyName - snake -
My Name->my_name - train -
My Name->my-name