JSPM

@iridiumco/wtmpl

0.5.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q12813F
  • License ISC

A CLI template engine for processing template files with variable replacement

Package Exports

  • @iridiumco/wtmpl
  • @iridiumco/wtmpl/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@iridiumco/wtmpl) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@iridium/wtmpl

A CLI template engine for processing template files with variable replacement.

Installation

npm install -g @iridium/wtmpl

Usage

Basic Usage

wtmpl -i <input-dir> -o <output-dir> key:value key2:value2

Examples

# 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-filename

Options

  • -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.json

Example Template Content

// {{projectName}}-folder/index.js
console.log('Hello from {{projectName}}!');
console.log('Created by: {{author}}');

License

ISC

Author

Jakub Porębski - Iridium Software