Methods
require(path) → {object}
Loads a new javascript file and return all exports from that file. Follows the require-js specification.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | Path for javascript file (relative or absolute and .js ending is optional). |
Returns:
Exports from loaded javascript.
- Type
- object
Examples
// Require relative to this
var other = resolve('./other.js');
// Require absolute
var other = resolve('/path/to/other.js');
// Require without .js extension
var other = resolve('./other');
resolve(path) → {object}
Resolves a path to another file. Can use relative or absolute path.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | Path to resolve. |
Returns:
Reference to a path.
- Type
- object
Examples
// Resolve relative to this
var path = resolve('./other.html');
// Reslove absolute
var path = resolve('/path/to/other.html');