#relative-filepath-from-module
Returns a filepath relative to the module you are in.
// file: /home/username/git/personal/relative-filepath-from-module/test/yet-another-dir/
import modulePathFromFile from 'relative-filepath-from-module'
const modulePath = modulePathFromFile(__dirname)
console.log(modulePath) // relative-filepath-from-module/test/yet-another-dir/
// file: /home/username/git/personal/relative-filepath-from-module/test/yet-another-dir/testFile.js
import modulePathFromFile from 'relative-filepath-from-module'
const modulePath = modulePathFromFile(__dirname)
console.log(modulePath) // relative-filepath-from-module/test/yet-another-dir/testFile.js
// file: /home/username/git/personal/relative-filepath-from-module/test/yet-another-dir
import modulePathFromFile from 'relative-filepath-from-module'
const modulePath = modulePathFromFile(__dirname)
console.log(modulePath) // relative-filepath-from-module/test/yet-another-dir
Should also work on windows, but have not tested. feedback is welcomed.