Skip to content

relative

Import from @varavel/vdl-plugin-sdk/utils/paths.

function relative(from, to): string;

Computes the relative path from one location to another.

Parameters

Parameter Type Description
from string Starting path.
to string Destination path.

Returns

string

The normalized relative path from from to to.

Example

relative("generated/models", "generated/types/user.ts");
// returns "../types/user.ts"

See

Powered by pathe (MIT License): https://github.com/unjs/pathe