'rekuire' is basically node's 'require' without the relative paths
Want to see pretty graphs? Log in now!
npm install rekuire
|17||downloads in the last day|
|77||downloads in the last week|
|520||downloads in the last month|
|Last Published By|
|Version||0.1.5 last updated 4 months ago|
|Keywords||require, rekuire , relative, path, node|
|Dependents (14)||avoscloud-code, avoscloud-code-mock-sdk, cli-mandelbrot, dupes, fogbugz-tagger, geoexif, git-repos, helpme, mean-mock, mock-js, nsyrc, osx-wifi-cli, tcmount, web-mock|
'rekuire' is basically node's 'require' without the relative paths!
It saves you TONS of time refactoring your code, and making it easily reusable. plus, it makes you code more readable = better!
to install, type
npm install rekuire
or add it to your
package.json as a dependency.
- fixed a bug that causes failures when scanning a package with higher os privileges (thanks Danny!)
- added a method to ignore folders while searching the right files (for example, the js files in the server's static folder)
- you can now rekuire file according to the relative path of the file
- added support for index.js files inside a folder - can be retrieved by the folder path
- added support for .coffee files and .json
How to use it?
instead of doing this:
var MyModule = require('../../../MyModule.js');<-- yuck!
why not do this:
var rek = require('rekuire'); var myModule = rek('MyModule');
var myCoffee = rek('MyCoffee.coffee'); var myJson = rek('myJson.json'); var myModule = rek('src/api/MyModule');
in order to tell the scanner, not to scan specific folders
var mypath = rek.ignore('out', 'target', 'static/js'); // you should only do it once in your code
if you want to resolve only the file location, for example, when you want to use proxyquire.
var mypath = rek.path('MyModule'); // mypath = 'lib/classes/MyModule.js'
for more examples, I recommend you to checkout the spec file :)
what does it do?
when 'rekuire' is first loaded to the project, it scans the source files locations, so when you need them they are right there to use! no relative paths are needed! yeahy!
if you are having any problems, requests or criticism, don't hesitate to open an issue, here
To test, run: