Package Exports
- filing-cabinet
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (filing-cabinet) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
filing-cabinet

Look up a filename based on a partial path
npm install filing-cabinet
Usage
var cabinet = require('filing-cabinet');
var result = cabinet({
partial: 'somePartialPath',
directory: 'path/to/all/files',
filename: 'path/to/parent/file',
config: 'path/to/requirejs/config',
webpackConfig: 'path/to/webpack/config'
});
console.log(result); // absolute/path/to/somePartialPathpartial: the dependency path- This could be in any of the registered languages
config: (optional) requirejs config for resolving aliased moduleswebpackConfig: (optional) webpack config for resolving aliased modules
Registered languages
By default, filing-cabinet provides support for the following languages:
- JavaScript (all files with the
.jsextension) - Sass (
.scssand.sass) - Stylus (
.styl)
You can register resolvers for new languages via cabinet.register(extension, resolver).
extension: the extension of the file that should use the custom resolver (ex: '.py', '.php')resolver: a function that accepts the following (ordered) arguments that were given to cabinet:partialfilenamedirectoryconfig
For examples of resolver implementations, take a look at the default language resolvers:
If a given extension does not have a registered resolver, cabinet will use
a generic file resolver which is basically require('path').join with a bit of extension defaulting logic.
Shell script
- Requires a global install
npm install -g filing-cabinet
filing-cabinet [options] <dependencyPath>
- See
filing-cabinet --helpfor details on the options