👋
Welcome to tempter
Your own sub-generator. In minutes. Bundled with your project.
Features
- Simple to use
- Supports both folder and single-file templates
- Lowercase, uppercase and even capitalized placeholders
- Placeholders work even in filenames
Usage
tempter
to your dev dependencies
1. Add yarn add -D tempter
# OR
npm install -dev tempter
Q: Why not CLI?
A: You can bundle it with your boilerplate this way!
generator.js
)
2. Create your generator file (e.g. // generator.js contents
require('tempter')('your/template/directory')
your templates to this directory
3. Add4. Done! You can now use your generator!
node generator.js
Tip: You may also add it to your npm scripts!
Docs
How to create a template
React Component
) for your template in your template directory (e.g. templates
)
1. Create a folder (e.g.
template.json
for your template
2. Create a config file
3. Add files
Just add template files in the same directory as template.json
.
Template configuration
{
"dir": "src/components",
"type": "subfolder"
}
Option | Description | Required |
---|---|---|
dir |
Says where our template should be coppied to | true |
type |
Determines if the template should be placed in a subfolder ("subfolder"), or just spread in dir ("spread") |
true |
Placeholders
Placeholders may be used in both filenames and the actual templates, they will be replaced by the generator.
Placeholder | Replaced by | Example |
---|---|---|
lowNAME | Name from input, lowercased | name |
uppNAME | Name from input, uppercased | NAME |
capNAME | Name from input, capitalized | Name |
Author
- Twitter: @RevionReaper
- Github: @DEVICARUS