Skip to content

Calculate the relative path from a file's destination path to another directory or file. Useful in template helpers, middleware and plugins.

License

Notifications You must be signed in to change notification settings

jonschlinkert/relative-dest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

relative-dest NPM version

Calculate the relative path from a file's destination path to another directory or file.

Install with npm

npm i relative-dest --save

Usage

var relative = require('relative-dest');

relative('dist/a/b/c.md', 'dist/public');
//=> '../../public'

relative('dist/a/b/c.md', 'assets');
//=> '../../../assets'

relative('a.md', 'dist/public/css');
//=> 'dist/public/css'

relative('a/b/c/', 'a/b/c/');
//=> '.'

API

Run tests

Install dev dependencies:

node i -d && mocha

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert
Released under the MIT license


This file was generated by verb on December 20, 2014.

About

Calculate the relative path from a file's destination path to another directory or file. Useful in template helpers, middleware and plugins.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published