project-template
Generate a project based on a directory of template files and corresponding template values.
Requirements
- Node JS v6+
Install
yarn add project-template
Example
yarn run example
See example/index.js
Usage
const projectTemplate = ; ;
Things to keep in mind
- Template files are expected to use ect syntax
- Directory structure of files in
templatePath
is maintained inbuildPath
- All files in
templatePath
withfileExtension
must be included inparams
- Files in
templatePath
withoutfileExtension
are just copied over tobuildPath
- You cannot have two files with the same file path where one has
fileExtension
and the other doesn't
API
projectTemplate(options) -> Promise<Array<String>>
options
Key | Type | Required | Default | Notes |
---|---|---|---|---|
templatePath | String | Yes | Directory path containing template files | |
buildPath | String | Yes | Directory path to write generated files to | |
params | Object | No | {} |
Keys are relative paths of template files (with fileExtension stripped). Values are objects of template variables |
ignoreFiles | Array<String> | No | [] |
File paths to ignore (exclude the fileExtension for template files). Useful for ect partials |
fileExtension | String | No | ect |
File extension of template files |
Result
The promise is resolved with an array of file paths of generated files, relative to the buildPath
directory.