p2r

0.5.0 • Public • Published

path-2-root

get path to project root

NPM

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');

Dependents (0)

Package Sidebar

Install

npm i p2r

Weekly Downloads

1

Version

0.5.0

License

MIT

Last publish

Collaborators

  • osrpt