I want to set up a task where I can set 2 parameters and not have to set them in the console every time I call it.
This is what I run on the console:
grunt serve:proxy --proxyServer=8.8.8.8 --proxyPort=9999
And these are the tasks that I have tried to declare but none of them works:
grunt.registerTask('serve:dev', 'serve:proxy:proxyServer=8.8.8.8:proxyPort=9999');
grunt.registerTask('serve:dev_', '', function(obj){
console.log ( grunt.config ('proxyServer')); //undefine
console.log ( grunt.option ('proxyServer')); //undefine
grunt.option('proxyServer', '8.8.8.8');
grunt.option('proxyPort', 9999);
console.log ( grunt.config ('proxyServer')); //undefine
console.log ( grunt.option ('proxyServer')); //8.8.8.8
grunt.task.run('serve:proxy');
});
In the log you can see that it always keeps the default configuration:
Proxy created for: /my_path to localhost:3000
Proxy created for: /my_path to localhost:3000
Proxy created for: /my_path to localhost:3000
Proxy created for: /my_path to localhost:3000