Untitled

 avatar
user_1095306
plain_text
a year ago
643 B
0
Indexable
Never
public static relativePath(fromPath: string, toPath: string): string {
		if (CSSPluginUtilities.startsWith(toPath, '/') || CSSPluginUtilities.startsWith(toPath, 'http://') || CSSPluginUtilities.startsWith(toPath, 'https://')) {
			return toPath;
		}

		// Ignore common folder prefix
		const prefix = CSSPluginUtilities.commonFolderPrefix(fromPath, toPath);
		fromPath = fromPath.substr(prefix.length);
		toPath = toPath.substr(prefix.length);

		const upCount = fromPath.split('/').length;
		let result = '';
		for (let i = 1; i < upCount; i++) {
			result += '../';
		}
		return result + toPath;
	}as of now this is i found