$ cnpm install copy-template-dir
High throughput template dir writes. Supports variable injection using the
mustache {{ }}
syntax.
$ npm install copy-template-dir
const copy = require('copy-template-dir')
const path = require('path.join')
const vars = { foo: 'bar' }
const inDir = path.join(process.cwd(), 'templates')
const outDir = path.join(process.cwd(), 'dist')
copy(inDir, outDir, vars, (err, createdFiles) => {
if (err) throw err
createdFiles.forEach(filePath => console.log(`Created ${filePath}`))
console.log('done!')
})
Copy a directory of files over to the target directory, and inject the files with variables. Takes the following arguments:
_
will have it removed when copying. Dotfiles need to be prepended
with a _
. Files and filenames are populated with variables using the
{{varName}}
syntax.Copyright 2013 - present © cnpmjs.org