Skip to content

Instantly share code, notes, and snippets.

@famousgarkin
Last active December 1, 2015 09:36
Show Gist options
  • Save famousgarkin/dfe52d8bbd96381a5386 to your computer and use it in GitHub Desktop.
Save famousgarkin/dfe52d8bbd96381a5386 to your computer and use it in GitHub Desktop.
grunt.registerTask('do', function () {
grunt.file.expand(['data/triggers/*.json']).forEach(function (file) {
var locale = path.basename(file, '.json');
var localeData = {};
JSON.parse(grunt.file.read(file)).records.forEach(function (trigger, i) {
localeData[['visit1', 'visit2', 'busy'][i]] = {
name: trigger.name,
description: trigger.description,
message: JSON.parse(trigger.source).actions[0].message
};
});
grunt.file.write('locale/triggers/' + locale + '.json', JSON.stringify(localeData, null, '\t'))
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment