Skip to content
This repository has been archived by the owner on Feb 10, 2019. It is now read-only.
/ rootrequire Public archive

npm install --save rootrequire # then `var root = require('rootrequire'), myLib = require(root + '/path/to/lib.js');`

License

Notifications You must be signed in to change notification settings

ericelliott/rootrequire

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

rootrequire

Require files relative to your project root.

Status - DEPRECATED - use ES6 modules, instead

Install

npm install --save rootrequire

Use

var
  root = require('rootrequire'),
  myLib = require(root + '/path/to/lib.js');

Why?

  • You can move files around more easily than you can with relative paths like ../../lib/my-lib.js
  • Every file documents your app's directory structure for you. You'll know exactly where to look for things.
  • Dazzle your coworkers.

Learn JavaScript with Eric Elliott

This was written for the "Learn JavaScript with Eric Elliott" courses. Don't just learn JavaScript. Learn how to change the world.

About

npm install --save rootrequire # then `var root = require('rootrequire'), myLib = require(root + '/path/to/lib.js');`

Resources

License

Stars

Watchers

Forks

Packages

No packages published