website: fix windows path issue. #161
This commit is contained in:
parent
8399eafe6e
commit
e0e7636ba4
@ -42,7 +42,7 @@ export async function createHTML(files = [], num = 0) {
|
||||
const { html, data } = create(mdstr.toString(), options);
|
||||
if (!options.isHome) {
|
||||
const searchData = await fs.readJSON(SEARCH_DATA_CACHE);
|
||||
data.path = path.relative(OUTOUT, outputHTMLPath);
|
||||
data.path = path.relative(OUTOUT, outputHTMLPath).replace(/[\\/]/g, '/');
|
||||
searchData[options.filename] = data;
|
||||
searchData.name = options.filename;
|
||||
await fs.writeJSON(SEARCH_DATA_CACHE, searchData);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user