Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

copy-template-dir

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

copy-template-dir

High throughput template dir writes

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
91K
decreased by-10.89%
Maintainers
1
Weekly downloads
 
Created
Source

copy-template-dir

NPM version build status Test coverage Downloads js-standard-style

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

Installation

$ npm install copy-template-dir

Usage

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) => {
  if (err) throw err
  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 are populated with variables using the {{varName}} syntax.
  • targetDir: the output directory
  • vars: An object with variables that are injected into the template files.
  • cb(err): A callback that is called on completion.

See Also

License

MIT

Keywords

FAQs

Package last updated on 13 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc