1.0.0 • Published 6 years ago

teg v1.0.0

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

teg

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

Greenkeeper badge Build Status dependencies Status Standard - JavaScript Style Guide Styled With Prettier

Installation

Install it once globally:

npm install -g teg

Usage

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

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.

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

import React, { Component } from 'react'

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

  </div>
)

export default {{file}}

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

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

To generate files from this template, run:

$ 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
1.0.0

6 years ago

0.8.0

7 years ago

0.7.4

7 years ago

0.7.3

7 years ago

0.7.2

7 years ago

0.7.1

7 years ago

0.7.0

7 years ago

0.6.0

7 years ago

0.5.0

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.0

7 years ago