Skip to content

tsukurite/templa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

templa

Build Status

plugin based generator

Installation

$ npm install tsukurite/templa

Usage

write index.json for output config.

[
  {
    "name": "hello-to-the-name",
    "data": {
      "name": "Alice"
    }
  },
  {
    "name": "hello-to-the-name",
    "data": {
      "name": "Bob"
    }
  }
]

install plugin modules.

$ npm install ./templa-te-hello-to-the-name

execute templa.

$ ./node_modules/.bin/templa ./index.json
Hi, Alice!
Hi, Bob!

Functions

execute(configs[ ,dir])

  • configs
    • Object[] - configs for template plugins
  • dir
    • String - change require directory
  • return
    • String[] - template plugin values

generate(configs[, dir])

  • configs
    • Object[] - configs for template plugins
  • dir
    • String - change require directory
  • return
    • String - template plugin value

How to write a template plugin

write package.json and index.js.

{
  "name": "templa-te-hello-to-the-name",
  "version": "0.0.0",
  "main": "./index.js",
  "private": true
}
module.exports = function(data) {
  return 'Hi, ' + data.name + '!\n';
};

Test

$ npm install
$ npm run build
$ npm test

License

The MIT license. Please see LICENSE file.

About

plugin based generator

Resources

License

Stars

Watchers

Forks

Packages

No packages published