mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-07-06 01:41:48 +02:00
New dropdown implementation
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { parseWinPath } from '../../helpers/parseWinPath';
|
||||
|
||||
export const getRelPath = (path: string, staticFolder?: string, wsFolder?: string) => {
|
||||
let relPath: string | undefined = '';
|
||||
if (wsFolder && path) {
|
||||
const wsFolderParsed = parseWinPath(wsFolder);
|
||||
const mediaParsed = parseWinPath(path);
|
||||
|
||||
relPath = mediaParsed.split(wsFolderParsed).pop();
|
||||
|
||||
// If the static folder is the root, we can just return the relative path
|
||||
if (staticFolder === '/') {
|
||||
return relPath;
|
||||
} else if (staticFolder && relPath) {
|
||||
const staticFolderParsed = parseWinPath(staticFolder);
|
||||
relPath = relPath.split(staticFolderParsed).pop();
|
||||
}
|
||||
}
|
||||
return relPath;
|
||||
};
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from './getRelPath';
|
||||
export * from './preserveColor';
|
||||
export * from './updateCssVariables';
|
||||
|
||||
Reference in New Issue
Block a user