Component generator
Main Trecli feature is component generator.
Generator command#
To generate component run default command:
or use full command
or use alias
Generator options#
Trecli ships with a handful of customizable options, usable in both the CLI and configuration file.
Index File Generation#
Specify if component contain index.ts file.
| Default | CLI option | CLI alias | Configuration file |
|---|---|---|---|
false | --index | --idx | index: <boolean> |
Styles Solutions#
Valid options:
"css"- Basic CSS stylesheet"css-modules"- CSS Modules stylesheet"material-ui"- Material-UI styles hook
| Default | CLI option | CLI alias | Configuration file |
|---|---|---|---|
false | --styles=<"css"∣"css-modules"∣"material-ui"> | -s | styles: <"css"∣"css-modules"∣"material-ui"∣false> |
note
If you have styles value specified in your configuration file you can still generate component without style by adding --no-styles or --no-s option to command.
Lazy Loaded#
Specify if component will be exporting named of default export. Default export is necessary if you are going to import component with React.lazy.
| Default | CLI option | CLI alias | Configuration file |
|---|---|---|---|
false | --lazy-loaded | -l | lazyLoaded: <boolean> |
More information about React.lazy and exports is available in official react documentation