# copy-template-dir

> High throughput template dir writes

Latest version **1.4.0** (published 2018-03-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install copy-template-dir
pnpm add copy-template-dir
yarn add copy-template-dir
bun add copy-template-dir
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2018-03-21 |
| First published | 2015-10-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 57 |
| Maintainers | insin, loklaan, yoshuawuyts |
| Keywords | template, directory, boilerplate, copy, concurrent |

## Links

- npm: https://www.npmjs.com/package/copy-template-dir
- Repository: https://github.com/yoshuawuyts/copy-template-dir
- Homepage: https://github.com/yoshuawuyts/copy-template-dir#readme
- Issues: https://github.com/yoshuawuyts/copy-template-dir/issues
- npm.io page: https://npm.io/package/copy-template-dir

## Dependencies (9)

- [pump](https://npm.io/package/pump.md) ^1.0.0
- [noop2](https://npm.io/package/noop2.md) ^2.0.0
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [readdirp](https://npm.io/package/readdirp.md) ^2.0.0
- [maxstache](https://npm.io/package/maxstache.md) ^1.0.0
- [graceful-fs](https://npm.io/package/graceful-fs.md) ^4.1.3
- [run-parallel](https://npm.io/package/run-parallel.md) ^1.1.4
- [end-of-stream](https://npm.io/package/end-of-stream.md) ^1.1.0
- [maxstache-stream](https://npm.io/package/maxstache-stream.md) ^1.0.0

## Recent versions

- 1.4.0 (latest) — 2018-03-21
- 1.3.0 — 2016-08-10
- 1.2.1 — 2016-03-16
- 1.2.0 — 2015-12-21
- 1.1.0 — 2015-12-13
- 1.0.5 — 2015-11-26
- 1.0.4 — 2015-10-06
- 1.0.3 — 2015-10-04
- 1.0.2 — 2015-10-04
- 1.0.1 — 2015-10-03
- 1.0.0 — 2015-10-03

## README

# copy-template-dir
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![Downloads][downloads-image]][downloads-url]
[![js-standard-style][standard-image]][standard-url]

High throughput template dir writes. Supports variable injection using the
mustache `{{ }}` syntax.

## Installation
```sh
$ npm install copy-template-dir
```

## Usage
```js
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!')
})
```

## API
### copyTemplateDir(templateDir, targetDir, vars, cb)
Copy a directory of files over to the target directory, and inject the files
with variables. Takes the following arguments:
- __templateDir__: The directory that holds the templates. Filenames prepended
  with a `_` will have it removed when copying. Dotfiles need to be prepended
  with a `_`. Files and filenames are populated with variables using the
  `{{varName}}` syntax.
- __targetDir__: the output directory
- __vars__: An object with variables that are injected into the template files
  and file names.
- __cb(err, createdFiles)__: A callback that is called on completion, with
paths to created files if there were no errors.

## See Also
- [maxstache-stream](https://github.com/yoshuawuyts/maxstache-stream)

## License
[MIT](https://tldrlegal.com/license/mit-license)

[npm-image]: https://img.shields.io/npm/v/copy-template-dir.svg?style=flat-square
[npm-url]: https://npmjs.org/package/copy-template-dir
[travis-image]: https://img.shields.io/travis/yoshuawuyts/copy-template-dir/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/yoshuawuyts/copy-template-dir
[codecov-image]: https://img.shields.io/codecov/c/github/yoshuawuyts/copy-template-dir/master.svg?style=flat-square
[codecov-url]: https://codecov.io/github/yoshuawuyts/copy-template-dir
[downloads-image]: http://img.shields.io/npm/dm/copy-template-dir.svg?style=flat-square
[downloads-url]: https://npmjs.org/package/copy-template-dir
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: https://github.com/feross/standard

---
_Source: https://npm.io/package/copy-template-dir · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
