Open joseluis opened 9 years ago
I think the best way to create a generator is by using yeoman: http://yeoman.io/authoring/
It already has support for creating custom generators.
Then the user will be able to type something like: yo mendula --modernizr
- and it will generate a version of the theme which has modernizr included. Plus a lot of developers are already familiar with yeoman and how it works. Yeoman can also set up gulp, bower, etc.
I think the theme itself needs to be a bit more mature before we start thinking about the generator though? For now I think its best to come up with things that are definitely going to be included in the default installation, and leave all the optional stuff that may be available through generator later commented out.
What do you think?
It looks very interesting, but I'm not familiarized with yeoman and I need to take a deep look into it. Do you know it very well?
What I was imagining before was creating gulp task that one could run to change some defaults, and substitute some templates. But yeoman is a whole different approach.
I agree that the priority must be the definition of the defaults. But I'll read about yeoman, because I'd like to figure out if it makes sense to have it in mind for this project.
I've worked with Yeoman for quiet a while now and it's amazing. I'm willing to have a go at creating the generator once the project has become somewhat stable. The nice thing about the Yeoman generator is that you can set it up that it auto-installs all the dependencies and leave some choices in the installer to include/exclude some stuff.
I suggest you try out the standard webapp generator. It gives a good feel of what is possible. That being said, I do think that a generator takes a lot of maintaining as you have to make sure you keep your dependencies up to date.
I work with yeoman as well, but I have not tried creating custom generators yet. @jan-dh would be good if you have a look at it when the theme is ready. I haven't looked into it myself, but if its similar to making npm packages - you should be able to make it use the latest versions of all dependencies, or the latest minor versions, like jQuery 1.x - this could be a possible way to avoid maintenance havoc.
A generator could solve the problem of having too many enabled elements. And provide more choices to the developer without cluttering the . But it can also make the project harder to maintain.
At the same time I also have the idea of creating a Constructor plugin, once Médula is more stable, that will make it possible to develop directly from the WordPress admin. And I'd like to have that in mind when considering the generator.
I lean strongly towards using a new gulp task for this, instead of creating a separate webapp like e.g. wppb.me is for WordPress Plugin Boilerplate
Also, I think there are some features that one may think wont be needed, when starting a project, but could come handy later. For example, Modernizr. I would want to be able to add it easily later.
The generator may be useful for choosing the default units. (related #37)