Templates
The generator uses Handlebars for file templates, with optional EJS support.
Template Location
Templates are resolved in this order:
- User templates directory (configurable)
- Built-in templates (bundled with the package)
Template Syntax (Handlebars)
Variables
handlebars
import { {{PascalName}}Props } from "./types"Available variables:
| Variable | Example |
|---|---|
{{PascalName}} | UserProfile |
{{camelName}} | userProfile |
{{snakeName}} | user_profile |
{{upperName}} | USER_PROFILE |
{{name}} | user-profile |
Example Template
Component.tsx.hbs:
handlebars
import React from "react"
import { {{PascalName}}Props } from "../types/{{PascalName}}Types"
interface {{PascalName}}Props {
// Add props here
}
export const {{PascalName}} = ({}: {{PascalName}}Props) => {
return <div>{/* {{PascalName}} component */}</div>
}EJS Support
Optionally use EJS templates. Install ejs:
bash
npm install ejsRegister the engine:
ts
registerTemplateEngine("ejs", myEjsEngine)Custom Templates
Override any built-in template by placing a file with the same name in your templates directory. The directory is specified in your config.