dotresolver

0.3.0 • Public • Published

dotresolver Version Badge

build status dependency status dev dependency status license

npm badge

Installation

npm install dotresolver --save

Basic usage

var R = require('dotresolver')('.');
 
// displays the root path .
console.log(R());
 
// displays the path ./src/controllers/hello.js
console.log(R('src.controllers', 'hello.js'));
 
// imports the module hello.js
var hello = R('src.controllers', 'hello.js', true);

Builder usage

var Resolver = require('dotresolver');
 
// builds resolver with some aliases
var R = Resolver.Builder(__dirname)
            .set('ctrl', 'src.controllers')
            .set('css', 'public.styles')
            .get();
 
// displays the path /home/steven/myapp/public/src/styles/base.css
console.log(R('css', 'base.css'));
 
// imports the module hello.js
var hello = R('ctrl', 'hello.js', true);

API

API documentation

Tests

npm test

Release History

  • 0.2.8 Fix issue #3
  • 0.2.7 Add helper to create URI resolver
  • 0.2.6 Fix issue #2
  • 0.2.5 Support object of aliases with setAlias()
  • 0.2.3 Improve the path building
  • 0.2.0 Remove real root path features
  • 0.1.0 Initial release

Credits

License

MIT

Package Sidebar

Install

npm i dotresolver

Weekly Downloads

5

Version

0.3.0

License

MIT

Last publish

Collaborators

  • enten