Publish your own packages to the world's most popular software ecosystem with npm Pro.Get started »

rootrelative

1.0.1 • Public • Published

rootrelative

enable require(rootRelativePath) by using an absolute path starting from the projects root directory npm install rootrelative

consider the following project structure:

  • myProject/
    • index.js
    • lib/
      • index.js
      • abc.js
      • def.js
      • helper/
        • xyz.js

[xyz.js]

var my = require('rootrelative');
var
  myProject = require(my('')),
  abc       = require(my('lib/abc.js'),
  lib       = require(my('lib')
;

Keywords

none

Install

npm i rootrelative

DownloadsWeekly Downloads

1

Version

1.0.1

License

ISC

Last publish

Collaborators

  • avatar