shortstop-resolve
v1.0.3
Published
a shortstop resolver like path but for node modules
Downloads
10,427
Maintainers
Readme
shortstop-resolve
Description
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
Example
'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');
});