Grunt templates only work within the Grunt config itself. grunt.file.readJSON
is a function that takes a single argument and does not process template patterns.
But rather just reads a JSON file from the specified file path and feeds that object to the Grunt config (which means the JSON file can contain Grunt template patterns).
Try the following instead:
grunt.initConfig({
filename: grunt.option('filename'),
config: grunt.file.readJSON(grunt.option('filename')),
// ... ... ...
});