Grunt task to modify javascript file
I have the following node.js javascript file.
module.exports = function(){
...
var config1 = "";
var config2 = "";
var config3 = "";
...
}
Suppose I have the following task:
grunt.registerTask('task1', ['...',copy]);
grunt.registerTask('task2', ['...',copy]);
grunt.registerTask('task3', ['...',copy]);
Depending on the task I'm running, the config value config1, config2, config3 needs to be changed.
For example:
grunt task1
should produce
module.exports = function(){
...
var config1 = "A";
var config2 = "B";
var config3 = "C";
...
}
while grunt task2
should produce
module.exports = function(){
...
var config1 = "X";
var config2 = "Y";
var config3 = "Z";
...
}
Is there any grunt plugin out there that can do this or similar?
+3
source to share