shortstop-resolve

a shortstop resolver like path but for node modules

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
shortstop-resolve
221.0.33 years ago10 years agoMinified + gzip package size for shortstop-resolve in KB

Readme

shortstop-resolve
Build Status

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');
});