1.4.0 • Published 6 years ago

copy-template-dir v1.4.0

Weekly downloads
84,922
License
MIT
Repository
github
Last release
6 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-clispact@cvpcasada/nwbchrome-extensions-clinetlify-cli@everything-registry/sub-chunk-1380script-custom-modulestock-ticker-react-widgetstart-right-clistacker-plugin-clidogfooddoghouse@devtools-ds/createcreate-light-apicreate-ghost-themecreate-hx-appcreate-nextjs-blogcreate-tiny-react-appcreate-react-styleguidereactor-templates-cliruiramos-netlify-cliroot-launcherrelauncherrincewindelement-boilerplatecreate-oss-packagecreate-nodecliscreate-nodejs-clicreate-nodejs-opapito-clicreate-node-cliqt-helper@decoupled/netlify-clicaplin-cli@awtrix/app@awtrix/devbuild-node-cli@bearer/cliclient-server-bundlercliggyclisolvercinch-clicli-up@chessboard/nwb@cloudux/ca@souravbaghel3212/create-nodejs-clicomponent-toolscomponent-template-builder@crissxross/create-node-clicrd-scriptscreate-biz-cardcreate-chief-appcreate-chrome-extension-appcreate-constellate-appatx-cli-generatorbootflow-cli@aschmidt8/netlify-clicustomized-netlify-clirdoc@design-systems/create-command@dreamjser/h5-template-generatorflex-dev-utilseternalsfaceliftcreate-cli-codeword7@ryanwelcher/scaffold-block@sa-pixaper/prismic-cli@saagie/sdk@sgrove/netlify-cliala-svgtofontapoly-nwb@whalecloud/fishx-svgtofont@senses-mirror/senses-cli@serkodev/svgtofont@torchlabs/netlify-cli@topfeed/topfeed-cli@topfeed/topfeed-init@steventripari/create-nodejs-cli@treshugart/nwb@strapi-community/strapi-tool-dockerizeahm-cliagg-generator@zyg_wtfm/create-nodejs-clianeeq-cli@zalastax/nolb-cop@tygr/cli@twilio/flex-dev-utils@umair-dev/ncliaspxsushil-cli-scaffolding4m-app-clitarecsvgfont-webpack-plugint3ktemplate-files-generatorsvgtofontsvgtofont4wqfixsvgtofontplussvg-to-iconfont
1.4.0

6 years ago

1.3.0

8 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.5

8 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago