https://github.com/unlight/requiro
Advanced version of require for node.js
https://github.com/unlight/requiro
Last synced: 7 months ago
JSON representation
Advanced version of require for node.js
- Host: GitHub
- URL: https://github.com/unlight/requiro
- Owner: unlight
- Created: 2015-05-01T20:15:12.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-04-02T16:20:51.000Z (about 9 years ago)
- Last Synced: 2024-04-24T01:02:22.598Z (about 2 years ago)
- Language: JavaScript
- Size: 21.5 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
requiro
=======
Advanced version of require for node.js.
INSTALL
-------
`npm install requiro`
USAGE
-----
```js
var require = require("requiro");
// Now we can use something like that:
var conf = require(">/config.{%NODE_ENV%}.js");
var car = require("~/app/models/car");
```
SYNTAX
------
Symbols | Resolves to | Example |
---------------------- | ----------------- | ---------------------- |
`>` or `>/` | Current working directory | `require(">/app/library/index.js")` |
`{%VAR}` or `{%VAR%}` | Environment variable | `require("./config.{%NODE_ENV%}.js")` |
`~/` | Closest directory with package.json | `require("~/app/library")` |
`//` | Project root | `require("//app/models/car")` |
RELATED STUFF
-------------
* Better local require() paths for Node.js - https://gist.github.com/branneman/8048520
* https://github.com/MattiSG/requirewith
* https://github.com/jaubourg/wires
TODO
----
1. Need put config somewhere
2. Multiple environment variables
CHANGELOG
---------
### May 1, 2015
- first release
### Dec 13, 2015
- added project root token `//`
- added closest directory with package.json `/~`