Skip to content

Instantly share code, notes, and snippets.

@vyp
Created June 7, 2015 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vyp/5f25b8648e9aef29f0f0 to your computer and use it in GitHub Desktop.
Save vyp/5f25b8648e9aef29f0f0 to your computer and use it in GitHub Desktop.
used for nylira/prism-break #1331
var fs = require('fs')
var path = require('path');
var _ = require('lodash');
var glob = require('glob');
var globOptions = {
'cwd' : './source/db/',
'mark' : true
};
var files = glob
.sync('*.json', globOptions);
files.forEach(function(filename) {
var fp = globOptions.cwd + filename;
var f = require(fp);
fs.writeFile(fp, JSON.stringify(_.sortBy(f, 'slug'), null, 2),
function (e) {
if (e) {
console.log(e);
}
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment