logicaroma
3/25/2013 - 4:04 PM

readOptionalJSON.js

'use strict';

module.exports = function(grunt) {

  function readOptionalJSON(filepath) {
    var data = {};
    try {
      data = grunt.file.readJSON(filepath);
      grunt.log.write('Reading data from ' + filepath + '...').ok();
    } catch(e) {}
    return data;
  }

  // Project configuration.
  grunt.initConfig({
    foo: readOptionalJSON('foo.json')
  });
};