I am attempting to read in an external json file and use that in a custom task:
Inside initConfig
grunt.initConfig({
env: grunt.file.readJSON("PATH"),
...
..
.
});
// Registering a task
grunt.registerTask('Namehere', 'DescriptionHere', function () {
// HOW DO I GET AT THE "env"
"<%= env.environment %>" // Doesnt work just gives me the string literal "<%= environmentVars.environment %>"
});
You're likely to use grunt.config.get("env") or grunt.config("env") for this purpose.
More info: http://gruntjs.com/api/grunt.config#grunt.config.get (thanks @Mike Fielden)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With