beginpm-template
Add templates to your module.
This is meant to be used with beginpm, but you can probably use it anywhere!
use
It's not very complicated:
const create = require('beginpm-template')
const cwd = '/path/to/module'
const options = {
templates: [{
from: '/absolute/path/to/input.txt',
to: 'OUTPUT.txt'
}]
}
create({ cwd }, options)
.then(() => {
// The file is written
// /path/to/module/OUTPUT.txt
})
options
templates
(array)
A list of objects mapping a template file to a generated file. The required properties for each object are:
from
(string)
This should be an absolute path to the template. A common pattern is:
{
from: path.join(__dirname, 'template/my-template.txt')
}
to
(string)
The output file, relative to the current working directory. If an intermediate folder is missing, it will be created.
license
This module beginpm-template
, and all code and documentation,
is published under the Very Open License