Skip to content

jasisk/shortstop-resolve

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

a shortstop resolver like path but for node modules

Resources

Stars

Watchers

Forks

Packages

No packages published