Skip to content

Instantly share code, notes, and snippets.

@hugoware
Created December 24, 2011 15:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hugoware/1517594 to your computer and use it in GitHub Desktop.
Save hugoware/1517594 to your computer and use it in GitHub Desktop.
Node.JS MapPath function
module.exports = {
//resolves the root of the site
map_path: function(path) {
return path.replace(/^~/, global.process.env.PWD);
},
//resolves the path and performs a require
require: function(path) {
path = module.exports.map_path(path);
return require(path);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment