website: fix windows path issue. #161

This commit is contained in:
jaywcjlove
2022-11-21 23:43:42 +08:00
parent 8399eafe6e
commit e0e7636ba4
2 changed files with 2 additions and 2 deletions

View File

@ -4,7 +4,7 @@ import { getSVGNode } from './getSVGNode.mjs';
const ICONS_PATH = path.resolve(process.cwd(), 'scripts/assets');
export function darkMode({ homePath = '', isHome } = {}) {
const relativePath = homePath.replace(/\/?index.html$/, isHome ? '' : '/');
const relativePath = homePath.replace(/[\\/]?index.html$/, isHome ? '' : '/');
const iconSunPath = path.resolve(ICONS_PATH, `sun.svg`);
const iconMoonPath = path.resolve(ICONS_PATH, `moon.svg`);
const sunNode = getSVGNode(iconSunPath);