requirem
v0.7.5
Published
Tiny, require 'em things with knobs
Downloads
14
Maintainers
Readme
requirem
usage
var requirem = require('requirem');
// works with no arguments,
var myProject = requirem();
// equivalent to require('./.') from any dir
// for directories,
var dirExports = requirem('./folder');
var dirExports = requirem('./folder/subfolder');
// and modules
var util = requirem('./lib/utils');
// if ./lib/utils is a module
// it will be required as so even if it was a directory
// exports are camelkeyed
var dirExports = requirem('./routes');
// ./routes was a directory but not a module
// {
// userAdmin : [Function] file was "user-admin.js"
// userSomething : [Function] file was "user.something.js"
// }
// filters via regexp
var headerExports = requirem(/header-(.*)\.js/);
var headerExports = requirem('./partial', /header-(.*)\.js/);
// {
// headerHome : [Function]
// headerSomething : [Function]
// }
// reload option cleans the require.cache
var gaze = new requirem('gaze').Gaze('./lib/*.js');
gaze.on('all', function(ev, filepath){
ev.delete || requirem(filepath, { reload : true })
});
~ 50 SLOC
install
$ npm install --save requirem
test
$ npm test