@iridiumco/wtmpl
v0.5.0
Published
A CLI template engine for processing template files with variable replacement
Downloads
4
Maintainers
Readme
@iridium/wtmpl
A CLI template engine for processing template files with variable replacement.
Installation
npm install -g @iridium/wtmplUsage
Basic Usage
wtmpl -i <input-dir> -o <output-dir> key:value key2:value2Examples
# Basic template processing
wtmpl -i templates -o output projectName:MyApp author:John version:1.0.0
# Using JSON parameters
wtmpl -i templates -o output -p '{"projectName":"MyApp","author":"John Doe"}'
# Dry run (preview changes)
wtmpl -i templates -o output projectName:MyApp --dry-run
# Skip variable replacement in content
wtmpl -i templates -o output projectName:MyApp --skip-vars
# Skip filename replacement
wtmpl -i templates -o output projectName:MyApp --skip-filenameOptions
-i, --input <path>- Input directory containing templates (required)-o, --output <path>- Output directory for processed templates (required)-p, --params <json>- Parameters as JSON object-d, --dry-run- Show what would change without writing files-sv, --skip-vars- Don't replace variables in file content-sf, --skip-filename- Don't change file names-sd, --skip-directory- Don't change directory names-f, --flags <json>- Flags as JSON object
Template Variables
Use {{variableName}} in your template files and filenames. Variables will be replaced with the values you provide.
Example Template Structure
templates/
├── {{projectName}}.txt
├── {{projectName}}-folder/
│ └── index.js
└── package.jsonExample Template Content
// {{projectName}}-folder/index.js
console.log('Hello from {{projectName}}!');
console.log('Created by: {{author}}');License
ISC
Author
Jakub Porębski - Iridium Software
