Skip to content

Instantly share code, notes, and snippets.

@logicaroma
Forked from cowboy/readOptionalJSON.js
Created March 25, 2013 16:04
Show Gist options
  • Select an option

  • Save logicaroma/5238222 to your computer and use it in GitHub Desktop.

Select an option

Save logicaroma/5238222 to your computer and use it in GitHub Desktop.
'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')
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment