Skip to content

Commit

Permalink
Fix preview basedir
Browse files Browse the repository at this point in the history
  • Loading branch information
mishamyrt committed Apr 2, 2023
1 parent 4709f77 commit 3572e29
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions preview/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import { execSync } from 'child_process'
import { viteSingleFile } from "vite-plugin-singlefile"
import { viteSingleFile } from 'vite-plugin-singlefile'

const FONTS_SOURCE = '../build'
const FONTS_TARGET = './public'

function lnFontDir(format: string) {
const sourcePath = `${FONTS_SOURCE}/${format}`
const targetPath = `${FONTS_TARGET}/${format}`
function lnFontDir (format: string) {
const sourcePath = `${FONTS_SOURCE}/${format}`
const targetPath = `${FONTS_TARGET}/${format}`

execSync(`rm -rf "${targetPath}"`)
execSync(`mkdir "${targetPath}"`)
execSync(`ln "${sourcePath}"/* "${targetPath}"`)
execSync(`rm -rf "${targetPath}"`)
execSync(`mkdir "${targetPath}"`)
execSync(`ln "${sourcePath}"/* "${targetPath}"`)
}

// https://vitejs.dev/config/
export default defineConfig(() => {
lnFontDir('otf')
lnFontDir('variable')
return {
plugins: [svelte(), viteSingleFile()],
}
lnFontDir('otf')
lnFontDir('variable')
return {
base: '',
plugins: [svelte(), viteSingleFile()],
}
})

0 comments on commit 3572e29

Please sign in to comment.