Skip to content

Instantly share code, notes, and snippets.

@codeBelt
Last active August 8, 2019 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeBelt/a7d3cb1cf75ff6975ac1822522a23401 to your computer and use it in GitHub Desktop.
Save codeBelt/a7d3cb1cf75ff6975ac1822522a23401 to your computer and use it in GitHub Desktop.
const {generateTemplateFiles} = require('generate-template-files');
generateTemplateFiles([
// Example of generating multiple files
{
option: 'Create Redux Store',
defaultCase: '(pascalCase)',
entry: {
folderPath: './tools/templates/',
},
stringReplacers: ['__store__', '__model__'],
output: {
path: './src/stores/__store__(kebabCase)',
pathAndFileNameDefaultCase: '(pascalCase)',
},
onComplete: (results) => {
console.log(`results`, results);
},
},
// Example of generating a single file
{
option: 'Create Redux Reduce',
defaultCase: '(pascalCase)',
entry: {
folderPath: './tools/templates/__store__Reducer.ts',
},
stringReplacers: ['__store__', '__model__'],
output: {
path: './src/stores/__store__/__store__(pascalCase)Reducer.ts',
pathAndFileNameDefaultCase: '(kebabCase)',
},
},
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment