0.1.0 • Published 12 years ago
local-lib v0.1.0
local-lib
Node.js require your local library files/modules easily from anywhere in
your project without having to navigate directories.
painful
var db = require('../../../../lib/db');the local-lib way
var db = require('local-lib').db;Installation
npm install local-libUsage
- add a
liborlibraryfolder in your project root. - add
.jsfiles,.jsonfiles, or module folders to your library - access your library easily using global require
Library folders should contain an index.js to export your library,
or a package.json file with a main directive to point to your main file.
Example
project structure
project root
├── lib
│ ├── utils
│ │ └── index.js
│ └── db.js
└── app.jsapp.js
var lib = require('local-lib');
var db = lib.db;
var utils = lib.utils;or
var db = require('local-lib').db;0.1.0
12 years ago