# tmplconv

> Two way template converter.

Latest version **5.0.1** (published 2019-03-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install tmplconv
pnpm add tmplconv
yarn add tmplconv
bun add tmplconv
```

Provides the command `tmplconv`.

## 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 | 5.0.1 |
| Published | 2019-03-20 |
| First published | 2015-09-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 11 |
| Unpacked size | 44 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Taka Okunishi |
| Maintainers | okunishinishi |
| Keywords | tmpl, convert, scaffold |

## Links

- npm: https://www.npmjs.com/package/tmplconv
- Repository: https://github.com/okunishinishi/node-tmplconv
- Homepage: https://github.com/okunishinishi/node-tmplconv#readme
- Issues: https://github.com/okunishinishi/node-tmplconv/issues
- npm.io page: https://npm.io/package/tmplconv

## Dependencies (11)

- [argx](https://npm.io/package/argx.md) ^4.0.0
- [asfs](https://npm.io/package/asfs.md) ^2.2.3
- [aglob](https://npm.io/package/aglob.md) ^3.0.1
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [rimraf](https://npm.io/package/rimraf.md) ^2.5.4
- [execcli](https://npm.io/package/execcli.md) ^5.0.6
- [findout](https://npm.io/package/findout.md) ^3.0.2
- [writeout](https://npm.io/package/writeout.md) ^2.1.0
- [commander](https://npm.io/package/commander.md) ^2.9.0
- [colorprint](https://npm.io/package/colorprint.md) ^5.0.3
- [stringcase](https://npm.io/package/stringcase.md) ^4.3.1

## Recent versions

- 5.0.1 (latest) — 2019-03-20
- 5.0.0 — 2019-03-20
- 3.2.1 — 2016-12-04
- 3.2.0 — 2016-12-04
- 3.1.3 — 2016-09-14
- 3.1.2 — 2016-09-11
- 3.1.1 — 2016-09-11
- 3.1.0 — 2016-09-11
- 3.0.9 — 2016-08-01
- 3.0.8 — 2016-07-30
- 3.0.7 — 2016-07-12
- 3.0.6 — 2016-07-12
- 3.0.5 — 2016-06-14
- 3.0.4 — 2016-06-07
- 3.0.3 — 2016-05-21
- … 10 more at https://npm.io/package/tmplconv/versions

## README

tmplconv
==========

<!---
This file is generated by ape-tmpl. Do not update manually.
--->

<!-- Badge Start -->
<a name="badges"></a>

[![Build Status][bd_travis_shield_url]][bd_travis_url]
[![npm Version][bd_npm_shield_url]][bd_npm_url]
[![JS Standard][bd_standard_shield_url]][bd_standard_url]

[bd_repo_url]: https://github.com/okunishinishi/node-tmplconv
[bd_travis_url]: http://travis-ci.org/okunishinishi/node-tmplconv
[bd_travis_shield_url]: http://img.shields.io/travis/okunishinishi/node-tmplconv.svg?style=flat
[bd_travis_com_url]: http://travis-ci.com/okunishinishi/node-tmplconv
[bd_travis_com_shield_url]: https://api.travis-ci.com/okunishinishi/node-tmplconv.svg?token=
[bd_license_url]: https://github.com/okunishinishi/node-tmplconv/blob/master/LICENSE
[bd_codeclimate_url]: http://codeclimate.com/github/okunishinishi/node-tmplconv
[bd_codeclimate_shield_url]: http://img.shields.io/codeclimate/github/okunishinishi/node-tmplconv.svg?style=flat
[bd_codeclimate_coverage_shield_url]: http://img.shields.io/codeclimate/coverage/github/okunishinishi/node-tmplconv.svg?style=flat
[bd_gemnasium_url]: https://gemnasium.com/okunishinishi/node-tmplconv
[bd_gemnasium_shield_url]: https://gemnasium.com/okunishinishi/node-tmplconv.svg
[bd_npm_url]: http://www.npmjs.org/package/tmplconv
[bd_npm_shield_url]: http://img.shields.io/npm/v/tmplconv.svg?style=flat
[bd_standard_url]: http://standardjs.com/
[bd_standard_shield_url]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg

<!-- Badge End -->


<!-- Description Start -->
<a name="description"></a>

Two way template converter.

<!-- Description End -->


<!-- Overview Start -->
<a name="overview"></a>


**my_awesome_func.js**
```
function myAwesomeFunc () {
  /* ... */
}
```

&nbsp;&nbsp;   &darr;&darr;   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   &uarr;&uarr;

Tmplify  &nbsp;&nbsp;  Render

&nbsp;&nbsp;   &darr;&darr;   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   &uarr;&uarr;

**____name<span></span>@snakecase____.js.tmpl**

```
function ____name@camelcase____ () {
  /* ... */
}
```


<!-- Overview End -->


<!-- Sections Start -->
<a name="sections"></a>

<!-- Section from "doc/guides/01.Installation.md.hbs" Start -->

<a name="section-doc-guides-01-installation-md"></a>

Installation
-----

```bash
npm install tmplconv --save-dev
```


<!-- Section from "doc/guides/01.Installation.md.hbs" End -->

<!-- Section from "doc/guides/02.Render.md.hbs" Start -->

<a name="section-doc-guides-02-render-md"></a>

Render Files from Template
---------

```javascript
'use strict'

const tmplconv = require('tmplconv')

// Render files from existing template
tmplconv.render('asset/app-tmpl', 'demo/demo-app', {
  // Data to render
  data: {
    'name': 'my-awesome-app',
    'description': "This is an example for the app templates."
  }
}).then((result) => {
  /* ... */
})

```

##### Render Options

| Key | Default | Description |
| --- | --- | --- |
| data |  | Name or path of data module. |
| pattern | '**/*.*' | File name patterns |
| ignore |  | File name patterns to ignore |
| prefix | '_____' | Embed prefix |
| suffix | '_____' | Embed suffix |
| extname | '.tmpl' | Embed Template extension name |
| silent |  | Disable console logs |
| clean |  | Cleanup destination directory before convert |
| once |  | Write only first time. Skip if already exists |
| mode | '644' | File permission to generate |



<!-- Section from "doc/guides/02.Render.md.hbs" End -->

<!-- Section from "doc/guides/03.Templify.md.hbs" Start -->

<a name="section-doc-guides-03-templify-md"></a>

Generate Template from Existing Files
---------

```javascript
'use strict'

const tmplconv = require('tmplconv')

// Generate template from existing directory
tmplconv.tmplify('demo/demo-app', 'asset/app-tmpl', {
  // Patterns of files to tmplify
  pattern: [
    'lib/*.js',
    'test/*_test.js'
  ],
  // Rule to tmplify
  data: {
    'name': 'my-awesome-app',
    'description': "This is an example for the app templates."
  }
}).then((result) => {
  /* ... */
})

```

##### Tmplify options
| Key | Default | Description |
| --- | --- | --- |
| data |  | Name or path of data module. |
| pattern | '**/*.*' | File name patterns |
| ignore |  | File name patterns to ignore |
| prefix | '_____' | Embed prefix |
| suffix | '_____' | Embed suffix |
| extname | '.tmpl' | Embed Template extension name |
| silent |  | Disable console logs |
| clean |  | Cleanup destination directory before convert |
| once |  | Write only first time. Skip if already exists |
| mode | '644' | File permission to generate |


<!-- Section from "doc/guides/03.Templify.md.hbs" End -->

<!-- Section from "doc/guides/04.Conversion.md.hbs" Start -->

<a name="section-doc-guides-04-conversion-md"></a>

#### String Conversion


You can use these functions to convert text before it is inserted into a template:

* __camelcase:__ "hello world" --> "HelloWorld"
* __pascalcase:__ "hello world" --> "helloWorld"
* __spinalcase:__ "hello world" --> "hello-world"
* __snakecase:__ "hello world" --> "hello_world"
* __uppercase:__ "hello world" --> "HELLO WORLD"
* __lowercase:__ "hello world" --> "hello world"
* __enumcase:__ "hello world" --> "hello:world"


<!-- Section from "doc/guides/04.Conversion.md.hbs" End -->

<!-- Section from "doc/guides/05.CLI.md.hbs" Start -->

<a name="section-doc-guides-05-cli-md"></a>

Using with CLI
---------

Install as a global module.

```bash
$ npm install tmplconv -g
```

#### CLI Usage:

```bash
$ tmplconv -h
Usage: tmplconv [options] [command]

Two way template converter.

Options:
  -V, --version                         output the version number
  -h, --help                            output usage information

Commands:
  tmplify [options] <srcDir> <destDir>  Generate a template from existing files
  render [options] <srcDir> <destDir>
  transplant [options] <src> <dest>     Tmplify and render at once

```

<!-- Section from "doc/guides/05.CLI.md.hbs" End -->


<!-- Sections Start -->


<!-- LICENSE Start -->
<a name="license"></a>

License
-------
This software is released under the [MIT License](https://github.com/okunishinishi/node-tmplconv/blob/master/LICENSE).

<!-- LICENSE End -->

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