Reputation: 188
Hi I'm building a Yeoman generator to create a wordpress/grunt/bootstrap boiler plate. I know one already exists but I'd like to set up the wordpress theme in a specific way.
One of my first steps is to install latest wordpress in the project's directory. I use
this.composeWith('wordpress', {});
To call another yeoman generator to install wordpress for me. My problem is that the wordpress files get directly copied in the root directory. Is there any ways to get the generator-wordpress to install in a specific sub-directory?
I know there is an option when setting up the wordpress generator to specify custom folder structure but I'd rather not go there and just call the generator in the right directory.
Regards
Alex
After a bit of research it seems an option has been added :
https://github.com/yeoman/generator-node/pull/186/files
Only I can't get it to work here is my index.js
var generators = require('yeoman-generator');
var userVars ={};
module.exports = generators.Base.extend({
constructor: function () {
// Calling the super constructor is important so our generator is correctly set up
generators.Base.apply(this, arguments);
// Next, add your custom code
this.option('coffee'); // This method adds support for a `--coffee` flag
var done = this.async();
},
prompting: function () {
return this.prompt([{
type : 'input',
name : 'name',
message : 'Your project name',
default : this.appname // Default to current folder name
},
{
type : 'input',
name : 'themeName',
message : 'Your wordpress theme name',
default : this.appname // Default to current folder name
}]).then(function (answers) {
userVars = {
name : answers.name,
themeName : answers.themeName,
}
this.log('app name', answers.name);
this.log('theme name', answers.themeName);
}.bind(this));
},
installWordpress: function() {
this.composeWith('wordpress', { options: { generateInto:'./wordpress'}});
},
method1: function () {
console.log();
},
method2: function () {
console.log('method 2 just ran');
}
});
Upvotes: 1
Views: 224
Reputation: 44609
generator-node
and generator-wordpress
are different generators. They don't expose the same options and don't work the same way.
You'll want to check the option the wordpress generator provide. If they don't support generating inside a specific directory, you should ask the generator-wordpress maintainers to add an option.
The core Yeoman system doesn't provide a way to override the destination folder of a composed generator.
Upvotes: 1