A handler for shortstop that resolves files relative to a node module or path.
var handler = resolve(__dirname); // With a basedir
var handler = resolve(); // Using the caller's directory as a basedir
'use strict';
var shortstop = require('shortstop');
var resolver = shortstop.create();
var assert = require('assert');
var resolve = require('shortstop-resolve');
resolver.use('resolve', resolve(__dirname));
var data = {
'dependency-image': 'resolve:dependency/image.png'
};
resolver.resolve(data, function (err, result) {
assert.equal(result['dependency-image'], '/path/to/my/code/node_modules/dependency/image.png');
});