Bundling STYL files to one bundled file.
npm install stylus-bundleBundles all SCSS imports into a single file recursively. This is a fork of scss-bundle which now only supports non-cli usage. Any help appreciated.




``typescript
import path from "path";
import { Bundler } from "stylus-bundle";
(async () => {
// Absolute project directory path.
const projectDirectory = path.resolve(__dirname, "./cases/tilde-import");
const bundler = new Bundler(undefined, projectDirectory);
// Relative file path to project directory path.
const result = await bundler.bundle("./main.styl");
})();
`
`typescript`
import { Bundler } from "stylus-bundle";
`ts`
constructor(fileRegistry: FileRegistry = {}, projectDirectory?: string) {}
##### Arguments
- fileRegistry?: Registry - Dictionary of files contents by full pathprojectDirectory?: string
- - Absolute project location, where node_modules are located. Used for resolving tilde imports
#### bundle
`typescript`
public async bundle(file: string, fileRegistry: Registry = {}): Promise
##### Arguments
- file: string - Main file full pathfileRegistry:
- Registry - Dictionary of files contents by full path
##### Returns
Promise<BundleResult>
#### BundleResult
`typescript`
import { BundleResult } from "stylus-bundle";
`typescript`
interface BundleResult {
imports?: BundleResult[];
tilde?: boolean;
filePath: string;
content?: string;
found: boolean;
}
##### Properties
- imports: BundleResult[] - File imports arraytilde?: boolean
- - Used tilde importfilePath: string
- - Full file pathcontent: string
- - File contentfound: boolean
- - Is file found
#### Registry
`typescript`
import { Registry } from "stylus-bundle";
`typescript`
interface Registry {
[id: string]: string | undefined;
}
##### Key
id: string - File full path as dictionary id
##### Value
string | undefined` - File content
Released under the MIT license.