Closed gizburdt closed 10 years ago
You can use the callback
option to handle it yourself. Just process stdout through http://gruntjs.com/api/grunt.template
Hi,
I tried multiple things, but I can't get it to work. This is my current code:
wp_config: {
command: 'php wp-cli.phar core config --dbname=<%= wp.config.db.name %> --dbuser=<%= wp.config.db.user %> --dbpass=<%= wp.config.db.password %> --dbhost=<%= wp.config.db.host %> --dbprefix=<%= wp.config.db.prefix %> --dbcharset=<%= wp.config.db.charset %> --locale=<%= wp.config.wp.lang %> --extra-php <<PHP ',
options: {
stdout: true,
callback: function( err, stdout, stderr, cb ) {
return "define('WP_CONTENT_DIR', dirname(__FILE__) . '/../wp-content');\ndefine('WP_CONTENT_URL', '" + grunt.config( 'project.url' ) + "')\nPHP";
cb();
}
}
},
The file is created, but the --extra-php is not handled and the task gets kind of stuck..
Hi,
I would like to run this command:
wp core config --dbname=<%= wp.config.db.name %> --dbuser=<%= wp.config.db.user %> --dbpass=<%= wp.config.db.password %> --extra-php <<< "define(\'WP_CONTENT_DIR\', dirname(__FILE__) . \'/../wp-content\');\n define(\'WP_CONTENT_URL\', \'<%= project.url =>\');"
The top three will work. Grunt will convert the variable
<%= wp.config.db.name %>
to the value of the options. But when I'm in STDIN (because of --extra-php), then Grunt won't convert the value, but just echoes<%= project.url =>
How can I get grunt to echo the value of the variable?
Thanks!