templord
v1.0.4
Published
Tool to generate code from ejs templates from a convention-based structure.
Downloads
4
Readme
Table of contents
Getting Started
npm i templord enquirer -D
Usage
How to use
- Create directory matching pattern
_template_${name}
in project. - Create
_decree.ts
file inside that directory. - Drop any files you want into directory prefixed with
_template
. Suffix them with.ejs
if you wish to use data returned by getDecree method. - By default templord will always ask you for directoryName to generate from template which can be used in ejs templates via
<%- directoryName %>
. - Run
npx templord
.
Example _decree.ts
import type * as Enquirer from 'enquirer';
const getDecree = async (enquirer: Enquirer) => {
const responses = await enquirer.prompt([
{
message: `Name:`,
name: `name`,
type: `input`,
},
]);
return responses;
};
export default getDecree;