A command tool to quickly generate files from templates directory.
You need to create a templates
folder in your project root and add your template files to it, structured like this:
root:.
├─templates
│ ├─component
│ │ ├─index.tsx
mmit [template] [-o <path>] [-r <filename>]
mmit component -o /src/components -r button
If you do not specify any options, you will be prompted to input them interactively.
<template>
- Specify template directory-o <path>
- Specify output path, default is./
-r <filename>
- Specify new file name. If you do not include this option, the file will retain its original name.
Of course, you can use -h
or --help
to display help information.
I recommend adding a shortcut command in scripts like this:
{
"scripts": {
"gen:component": "mmit component -o /src/components"
}
}
- support variables replace