p2r
v0.5.0
Published
get path relative to project dir
Downloads
3
Readme
##path-2-root
get path to project root
###Install
npm install p2r
Note: you must not install this package globally!
###Example
In root/foo/bar/baz/qux/
you have a file lib.js
, you want to require
file config.js
in root
dir.
Instead:
var lib = require('../../../../../config.js');
With:
var p2r = require('p2r');
var lib = require(p2r.path('config.js'));
Or:
var p2r = require('p2r');
var lib = p2r.require('config.js');