graceful-copy
Gracefully copy a directory with templates.
Last updated 4 years ago by rem .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install graceful-copy 
SYNC missed versions from official npm registry.

graceful-copy

NPM version NPM downloads Build Status

Gracefully copy a directory with templates.

Why is this useful?

This could be used to build a scaffolding tool like yeoman or vue-cli.

Install

$ npm install --save graceful-copy

Usage

const copy = require('graceful-copy')

copy('./template', './dest', {
  data: {
    foo: 'bar'
  }
}).then(files => {
  console.log(files) // array of filenames in './dest'
}).catch(err => {
  console.log(err.stack)
})

Templates

Templates could use handlebars syntax.

API

copy(src, dest, options)

src: string

Source directory. Could be a relative or absolute path.

dest: string

Destination directory.

options: object

clean: boolean

Whether to clean destination directory before writing to it. Defaults to true.

cwd: string

Current working directory. Defaults to process.cwd().

data: object

The data to render templates in source directory.

skipInterpolation: string | string[]

Patterns used to skip interpolation, eg: ./foo*/bar-*.js


graceful-copy © EGOIST, Released under the MIT License.
Authored and maintained by EGOIST with help from contributors (list).

egoistian.com · GitHub @egoist · Twitter @rem_rin_rin

Current Tags

  • 1.1.0                                ...           latest (4 years ago)

5 Versions

  • 1.1.0                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (2)
Downloads
Today 0
This Week 39
This Month 0
Last Day 1
Last Week 31
Last Month 115
Dependencies (5)
Dev Dependencies (5)

Copyright 2014 - 2016 © taobao.org |