Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lassehaslev/templater
CLI (Command Line Interface) template engine for all sorts of files
https://github.com/lassehaslev/templater
cli cli-app nodejs productivity template templater utility
Last synced: 4 days ago
JSON representation
CLI (Command Line Interface) template engine for all sorts of files
- Host: GitHub
- URL: https://github.com/lassehaslev/templater
- Owner: LasseHaslev
- Created: 2017-03-27T21:09:03.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-04-25T09:23:27.000Z (over 7 years ago)
- Last Synced: 2024-10-11T15:11:01.890Z (about 1 month ago)
- Topics: cli, cli-app, nodejs, productivity, template, templater, utility
- Language: JavaScript
- Size: 28.3 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @lassehaslev/templater
> CLI (Command Line Interface) template engine for all sorts of files## Install
```bash
npm install @lassehaslev/templater --save
```## Usage
Templater takes 2 parameters
1. [Inquirer.js objects](https://github.com/sboudrias/Inquirer.js#objects) (Array)
2. Options (Object)
- ```templateFolder``` default:```__dirname + '/../templates'```
- What folder to find templates
- ```folder``` default:```process.argv[2] || './'```
- Where to add new templates```js
#! /usr/bin/env nodevar Templater = require( '@lassehaslev/templater' );
var templater = new Templater([
{
type: 'input',
name: 'author.name',
message: 'Whats your name?',
default: 'My name',
},
{
type: 'input',
name: 'author.email',
message: 'Whats your email?',
default: '[email protected]',
},
], {
templateFolder: __dirname + '/../templates',
});templater.start().then( function( response ) {
console.log( 'All complete'! );
} );
```#### Templates
You can add any files in this folder. All files and folders/subfolders added in this folder will be copied to destination and rendered with new variables.Use ```<% variable.name %>``` syntax to edit your variables.
###### Example file
```php
<<% author.email %>>
*/
class TestFile
{
}
```*This will render*
```php*/
class TestFile
{
}
```