Templates

October 31, 2015 · View on GitHub

Khaos is a scaffolding tool where one of the arguments or inputs is the base template. This section describes how to create a template for Khaos.

Let's use this template for creating a node module as an example.

Structure

Everything that will be scaffolded into the destination directory must be in the template's ./template folder:

.
├── template
│   └── <stuff>
├── History.md
└── Readme.md

Everything on the same level as ./template won't be used by Khaos.

Inside the ./template directory is the actual template / seed / boilerplate of what you want in the destination directory. The only difference is adding handlebars templating and logic.

Note that the handlebars can go anywhere. You can see it in the README.md:

Usage

With JavaScript:

var template = resolve('../path/to/template');
var schema = require('../path/to/schema.json');

var khaos = new Khaos(template)
  .schema(schema);

With CLI:

$ khaos create <path/to/template> new-project

..or, with GitHub..

$ khaos create <github-org/github-repo> new-project