# teg

> Template Generator

Latest version **1.0.0** (published 2018-01-27) · ISC license · 0 weekly downloads

## Install

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

Provides the command `teg`.

## 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 | 1.0.0 |
| Published | 2018-01-27 |
| First published | 2016-11-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | tu4mo |
| Maintainers | tu4mo |
| Keywords | template, generator, boilerplate, cli, tool |

## Links

- npm: https://www.npmjs.com/package/teg
- Repository: https://github.com/tu4mo/teg
- Issues: https://github.com/tu4mo/teg/issues
- npm.io page: https://npm.io/package/teg

## Dependencies (1)

- [change-case](https://npm.io/package/change-case.md) ^3.0.1

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-01-27
- 0.8.0 — 2017-07-01
- 0.7.4 — 2017-04-11
- 0.7.3 — 2017-03-05
- 0.7.2 — 2017-01-15
- 0.7.1 — 2016-12-19
- 0.7.0 — 2016-12-12
- 0.6.0 — 2016-12-11
- 0.5.0 — 2016-11-19
- 0.4.0 — 2016-11-17
- 0.3.0 — 2016-11-16
- 0.2.0 — 2016-11-15
- 0.1.1 — 2016-11-13
- 0.1.0 — 2016-11-13
- 0.0.0 — 2016-11-13

## README

# teg

*teg* is command-line utility to generate customized template/boilerplate files and folders.

[![Greenkeeper badge](https://badges.greenkeeper.io/tu4mo/teg.svg)](https://greenkeeper.io/)
[![Build Status](https://travis-ci.org/tu4mo/teg.svg?branch=master)](https://travis-ci.org/tu4mo/teg)
[![dependencies Status](https://david-dm.org/tu4mo/teg/status.svg)](https://david-dm.org/tu4mo/teg)
[![Standard - JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
[![Styled With Prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)

## Installation

Install it once globally:

```sh
npm install -g teg
```

## Usage

Teg accepts two arguments. `template` defines which template to use. `file` defines the output filename.

```sh
teg <template> <file>
```

## Templates

* A template is just a folder that contains files used to generate new files.
* Place templates in `~/.teg/templates` directory.
* Template's files and folders named `_index(.*)` are automatically renamed to the file specified in the `<file>` parameter.

### Tags

* You can use tags inside templates.
* Currently only supported tag is `{{file}}`, which will be replaced by the name defined for `file` argument.
* The case of the value of a tag can be changed by using a pipe: `{{file|paramCase}}`. Check out [available methods](https://github.com/blakeembrey/change-case).

### Example of a template

A template can contain anything. Here's any example of a template to create React component, with a CSS file.

#### ~/.teg/templates/react-const/\_index.js

```javascript
import React, { Component } from 'react'

const {{file}} = () => (
  <div className="{{file|paramCase}}">

  </div>
)

export default {{file}}
```

#### ~/.teg/templates/react-const/\_index.css

```css
.{{file|paramCase}} {
  display: flex;
}
```

To generate files from this template, run:

```sh
$ teg react-const NewComponent
```

This will generate two new files, `NewComponent.js` and `NewComponent.css`, in the current working directory, replacing `{{file}}` tag with `NewComponent` and `{{file|paramCase}}` with `new-component`.

## TODO

* Custom `{{tags}}` inside templates
* Configuration for tags' formatting

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