Skip to content

Instantly share code, notes, and snippets.

@csainty
Created February 24, 2015 10:47
Show Gist options
  • Save csainty/e318a7ede4b83dcb9dce to your computer and use it in GitHub Desktop.
Save csainty/e318a7ede4b83dcb9dce to your computer and use it in GitHub Desktop.
Super simple grunt task to update a json config file in the package
grunt.registerTask('config', function (env) {
var config = grunt.file.readJSON('src/config.json');
var envs = {
production: {
apiUrl: 'http://foo.com'
},
staging: {
apiUrl: 'http://bar.com'
}
};
config = _.extend(config, envs[env]);
grunt.file.write('dist/config.json', JSON.stringify(config));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment