Skip to content

Commit

Permalink
fix docs build for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
emilefokkema committed Jul 24, 2024
1 parent c80aa7c commit 41f18d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions utils/dark-theme/vite-plugin/add-dark-css-loader.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { fileURLToPath } from "url"
import path from 'path'
import fs from 'fs'
import { readFile } from 'fs/promises'
import { PluginOption, HtmlTagDescriptor, build } from "vite"
import { DARK_THEME_STYLE_ID, DARK_THEME_CSS_CONTENT_ID } from '../shared/constants'

Expand All @@ -21,12 +20,11 @@ function isDarkRequested(fileName: string, originalUrl: string | undefined): boo
if(originalUrl){
return new URL(originalUrl, 'http://www.example.com').searchParams.get('dark') === 'true'
}
return /\/index-dark\.html/.test(fileName);
return /[\\/]index-dark\.html/.test(fileName);
}

export function addDarkCssLoader(): PluginOption{
const loadDarkThemePath = fileURLToPath(new URL('../frontend/shared/load-dark-theme.ts', import.meta.url))
//const loadDarkThemeModuleId = 'dark-theme-plugin-load-dark-theme';
let root: string
let base: string;
let outDir: string;
Expand Down
6 changes: 3 additions & 3 deletions utils/dark-theme/vite-plugin/add-index-dark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function addIndexDarkToInput(): PluginOption{
addInputForIndexDark(root, 'root-index-dark');
}
for(const {input, alias} of findExistingInputs(existingInput)){
if(!input || !/\/index\.html$/.test(input)){
if(!input || !/[\\/]index\.html$/.test(input)){
continue;
}
const directory = path.dirname(input)
Expand All @@ -71,13 +71,13 @@ export function addIndexDarkToInput(): PluginOption{
}
},
resolveId(id){
if(!/\/index-dark\.html/.test(id)){
if(!/[\\/]index-dark\.html/.test(id)){
return;
}
return id;
},
async load(id){
if(!/\/index-dark\.html/.test(id)){
if(!/[\\/]index-dark\.html/.test(id)){
return;
}
const directory = path.dirname(id);
Expand Down

0 comments on commit 41f18d2

Please sign in to comment.