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

Comments

Projects
None yet
4 participants
@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

This comment has been minimized.

Copy link
Contributor

matthewp commented Aug 15, 2016

We should have a documentation tag.

@justinbmeyer justinbmeyer added the p3 label Oct 18, 2016

@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

@justinbmeyer justinbmeyer referenced this issue Nov 2, 2017

Closed

Epoch 1 Survey Questions #77

24 of 24 tasks complete
@phillipskevin

This comment has been minimized.

Copy link
Contributor

phillipskevin commented Nov 3, 2017

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

phillipskevin commented Nov 3, 2017

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

This comment has been minimized.

Copy link
Contributor

phillipskevin commented Jun 2, 2018

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
You can’t perform that action at this time.