1.4.0 • Published 7 years ago

copy-template-dir v1.4.0

Weekly downloads
84,922
License
MIT
Repository
github
Last release
7 years ago

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, 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

License

MIT

@tkil/tmpl-cli@carltonj2000/cli2@modngn/cli@ifqthenp/create-node-cli@cvpcasada/nwb@everything-registry/sub-chunk-1380tarect3ksvgtofont4wqfixsvgtofontplussvgfont-webpack-pluginwipaytemplateworkflo-componentsxirotemplate-files-generatorstacker-plugin-clisvg-to-iconfont@dreamjser/h5-template-generator@cloudux/ca@crissxross/create-node-cli@primecms/clijipi-svg2fontirreal-netlify-dev-plugin-forkironlauncherironlauncher-ejsjnwbke-create-node-clikoa-init-cli4m-app-cli@ryanwelcher/scaffold-blockstart-right-clistock-ticker-react-widgettmpl-cli@aschmidt8/netlify-cli@awtrix/app@awtrix/dev@bearer/cli@chessboard/nwb@decoupled/netlify-cli@design-systems/create-command@devtools-ds/create@guillermobrachetta/ncli@hashicorp/dato-migration-gen@iampava-devtools-ds/create@iamrokt/create-new-cli@httptoolkit/netlify-cli@eliperelman/netlify-cli@gness1804/create-node-cli@ksakira10/nwb@kuscamara/create-lit-component@ivoyant/cli@kirill.konshin/nwb@saagie/sdk@sa-pixaper/prismic-cli@ps-cli/express@ps-cli/react@rexlabs/plz-cli@paulisystems/create-cli@ou-imdt/create@ou-imdt/imdt-create@souravbaghel3212/create-nodejs-cli@serkodev/svgtofont@senses-mirror/senses-climy-beern-create-clinwboh-openai-clinscaleruiramos-netlify-cliroot-launcherrdocrelauncherscript-custom-modulenode-cli-resumeneutrino-preset-inflnetlify-dev-pluginnetlify-cli-forknetlify-plugin-search-indexnextgnew-node-clingextnext-newnext-ignitereactor-templates-clirincewindqt-helperreact-start-templategimme-reasonife-svgtofonticonticont-cliicon2fonticon2font2initialize-cliinitialize-projectinitialize-rusthorus-react-scriptsmarki-genlq-server-cli@whalecloud/fishx-svgtofont
1.4.0

7 years ago

1.3.0

9 years ago

1.2.1

9 years ago

1.2.0

9 years ago

1.1.0

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago