Lets say there is a grunt command build_release_android as shown below:
cordovacli: {
.....
build_release_android: {
options: {
command: 'build',
platforms: ['android'],
args: ['--release', "--buildConfig=..//build_android.json"]
}
}
.....
}
This command can be run in console as grunt cordovacli:build_release_android.
Now in Mac this works fine, but if run same command on Windows console, I have to change path as "--buildConfig=..\build_android.json"
So is there any way to run command without manually doing any change, everytime its run on different platforms
In your gruntfile.js
, you can check your environment's operating system and can use whichever arguments are appropriate. For example:
var os = require('os');
...
cordovacli: {
...
build_release_android: {
options: {
command: 'build',
platforms: ['android'],
args: /^win/.test(os.platform()) ?
['--release', '--buildConfig=..\\build_android.json'] :
['--release', '--buildConfig=../build_android.json']
}
}
...
}