jondot / hygen

The simple, fast, and scalable code generator that lives in your project.
http://www.hygen.io
MIT License
5.68k stars 256 forks source link

Allow to change the default `_templates` directory on `hygen init` #380

Open lktslionel opened 2 years ago

lktslionel commented 2 years ago

I want to be able to change the default template directory name _templates by whatever I want. I like to use dotted directory (Eg: .templates) for things not directly related to the core of my project. So, I will be great if could set the parameter --tmpls-dir when initializing the hygen inot my project.

So, intializing the hygen with a custom templates dir will be done as follows:

hygen init self --tmpls-dir .templates

The command below will:

  1. Initialize all templates inside .templatesdirectory instead of the default _templates dir.
  2. Create a .hygen.js file settings the new templates dir as default for templated discovery with contents:
    module.exports = {
    templates: `${__dirname}/.templates`
    }

Let me know if it make sens, so that I can contribute.

I'm new to the project, that's why any guidance on the parts of the code to change, will be helpful. It looks like it is the setup ops that is doing the init.

Thanks

jondot commented 2 years ago

This is a great idea I would be happy to accept a PR for it

marckraw commented 1 year ago

any update on this one ? :)