I create the Yeoman generator and the necessary dependencies for this from https://github.com/sboudrias/mem-fs-editor#copytplfrom-to-context-settings and https://github.com/SBoudrias/Inquirer.js/
The idea is to be able to ask the user a question and repeat the same question, i.e. you want to add another ... if the user adds another, then he will link and record this answer, and if the user says no or callbacks, the request will be stopped.
I would like all the answers to be tied to an arrangement that can be passed to another function of the object so that it can display the answers in an array.
Here is the code so far ... First, an invitation will appear:
askForTest1: function () {
if (this.type == 'foundation5') {
var cb = this.async();
var prompts = {
type: 'input',
name: 'test1',
message: chalk.yellow(' What is your favorite movie'),
default: 'Star Wars!'
};
this.prompt(prompts, function (props) {
this.templatedata.test1 = props.test1;
cb();
}.bind(this));
}
},
Then there is a copyTpl object that will link the parameters for the template assembly: This is the desired result that I would like to happen ... and remember that this copy of tpl lives in the same index.js file as the prompts. those. this template ...
this.fs.copyTpl(
this.templatePath('/index2.html'),
this.destinationPath('app/index2.html'),
{ title: [this.templatedata.test1-a, this.templatedata.test1-b, this.templatedata.test1-c, ...], h1: this.applicationName }
);
as a result ... a template with this code ...
viawill create this ...
using foo1
using foo2
It is possible and how I will do it.