Skip to content

Commit

Permalink
website: fix windows path issue. jaywcjlove#161
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Nov 21, 2022
1 parent d7c5b66 commit 78e8fe9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scripts/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion scripts/utils/darkMode.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 78e8fe9

Please sign in to comment.