Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add katex support #75

Closed
wants to merge 12 commits into from
17 changes: 12 additions & 5 deletions build.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import archiver from 'archiver'
import esbuild from 'esbuild'
import fs, { promises as fsPromises } from 'fs'

import fs from 'fs-extra'
import { lessLoader } from 'esbuild-plugin-less'
const outdir = 'build'

async function deleteOldDir() {
await fsPromises.rm(outdir, { recursive: true, force: true })
await fs.rm(outdir, { recursive: true, force: true })
}

async function runEsbuild() {
Expand All @@ -25,6 +25,13 @@ async function runEsbuild() {
jsxFactory: 'h',
jsxFragment: 'Fragment',
jsx: 'automatic',
loader: {
'.ttf': 'dataurl',
'.woff': 'dataurl',
'.woff2': 'dataurl',
'.less': 'css',
},
plugins: [lessLoader()],
})
}

Expand All @@ -39,10 +46,10 @@ async function zipFolder(dir) {
}

async function copyFiles(entryPoints, targetDir) {
await fsPromises.mkdir(targetDir)
await fs.mkdir(targetDir)
await Promise.all(
entryPoints.map(async (entryPoint) => {
await fsPromises.copyFile(entryPoint.src, `${targetDir}/${entryPoint.dst}`)
await fs.copy(entryPoint.src, `${targetDir}/${entryPoint.dst}`)
}),
)
}
Expand Down
Loading