Skip to content

Instantly share code, notes, and snippets.

@dhigginbotham
Created February 15, 2013 22:51
Show Gist options
  • Save dhigginbotham/4964246 to your computer and use it in GitHub Desktop.
Save dhigginbotham/4964246 to your computer and use it in GitHub Desktop.
Folder structure creator, so i dont have to keep doing it... prolly going to add file gen too
//super.builder.js
var mkdirp = require('mkdirp');
var fs = require('fs');
var path = require('path');
var output_path = path.join(__dirname, 'build');
var paths = [
{route: "conf", children: ["schema"]},
{route: "library", children: ["less"]},
{route: "modules", children: []},
{route: "public", children: ["css", "js", "img", "fonts"]},
{route: "routes", children: []},
{route: "views", children: ["templates", "parts"]},
];
var make_build = function() {
for (var i=0;i<paths.length;++i) {
// console.log('creating: /' + paths[i].route);
var parent = path.join(__dirname, 'build', paths[i].route);
mkdirp(parent, function(err) {
if (err) throw err;
console.log('created' + parent);
});
for(var k=0;k<paths[i].children.length;++k) {
// console.log('creating: /' + paths[i].route + '/' + paths[i].children[k]);
var child = path.join(__dirname, 'build', paths[i].route, paths[i].children[k]);
mkdirp(child, function(err) {
if (err) throw err;
console.log('created ' + child);
});
}
}
}
!function() {
make_build();
}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment