Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for customizing the generator templates #140

Open
chasenlehara opened this issue Aug 15, 2016 · 5 comments
Open

Add docs for customizing the generator templates #140

chasenlehara opened this issue Aug 15, 2016 · 5 comments

Comments

@chasenlehara
Copy link
Member

chasenlehara commented Aug 15, 2016

tldr; Document how to customize templates within the .donejs/templates/ folder.

This was discussed on a recent live stream (38:36), a previous live stream (56:06), and at a contributors meeting (55:34).

The Problem

Often times people will want to use the generators, but have to then change the generated files because their project is customized in some way. One example might be using mocha instead of QUnit. The donejs-mocha package will create templates in .donejs/templates/ that will be used instead of the standard templates.

A user can do the same thing, by copying the standard templates into the .donejs/templates/ folder and modifying them.

This is a cumbersome process because:

  • You have to manually copy them from the generator-donejs project. Gross!
  • There is no documentation on what you are supposed to do (including the above).

The Solution

This is a two part solution.

donejs customize

Running donejs customize (or some other command, I don't care) will create the .donejs/templates/ folder for you, and populate it with all of the default templates.

Document customizing these on donejs.com

Under Guides add a Customizing Generator Templates guide, that walks through step by step of running donejs customize and then customizing one of the templates.

@matthewp
Copy link
Contributor

We should have a documentation tag.

@justinbmeyer justinbmeyer changed the title Add docs for customizing the generated files Add docs for customizing the generated files ~5 Oct 18, 2016
@chasenlehara chasenlehara changed the title Add docs for customizing the generated files ~5 Add docs for customizing the generated files Aug 30, 2017
@matthewp matthewp changed the title Add docs for customizing the generated files Add docs for customizing the generator templates Sep 22, 2017
@phillipskevin
Copy link
Contributor

Instead of donejs customize, why not just have the current commands add the templates? I think donejs add app could add the templates for components, supermodel, and module and that would solve the same problem without an additional command.

@matthewp
Copy link
Contributor

matthewp commented Nov 3, 2017

That's a possibility. It would be a big change though. Do you want projects polluted with default templates that you're not going to update? What if we fix a bug in generator-donejs that changes the template, since yours are in .donejs/templates/ you won't get the bug fix.

@phillipskevin
Copy link
Contributor

It would be a big change though.

The code change wouldn't be that big I don't think (although I realize this probably isn't what you meant).

Do you want projects polluted with default templates that you're not going to update?

I don't think this is a big deal. I think it would help people realize they can do something with them.

What if we fix a bug in generator-donejs that changes the template, since yours are in .donejs/templates/ you won't get the bug fix.

This is a good point.

Whether or not we do it by default or add donejs customize we'll need to figure out how to handle conflicts. Someone could run donejs customize, modify a template, and run donejs customize again.

@phillipskevin
Copy link
Contributor

I think we should do this with a plugin. So you would run donejs add generator-templates and the donejs-generator-templates plugin would get the files from each of the plugin directories of this project and copy them into your app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants