93 lines
2.3 KiB
Plaintext
93 lines
2.3 KiB
Plaintext
---
|
|
title: open-slide.config.ts
|
|
description: Workspace-level configuration.
|
|
---
|
|
|
|
The config lives at the workspace root and is fully optional — every field
|
|
has a sensible default.
|
|
|
|
```ts title="open-slide.config.ts"
|
|
import type { OpenSlideConfig } from '@open-slide/core';
|
|
|
|
const config: OpenSlideConfig = {};
|
|
|
|
export default config;
|
|
```
|
|
|
|
## Schema
|
|
|
|
```ts
|
|
type OpenSlideBuildConfig = {
|
|
/** Show the deck index (the slide browser) in the static build. */
|
|
showSlideBrowser?: boolean;
|
|
/** Show on-canvas UI (toolbar, hints) in the static build. */
|
|
showSlideUi?: boolean;
|
|
/** Show the "download as HTML" button in the static build. */
|
|
allowHtmlDownload?: boolean;
|
|
};
|
|
|
|
type OpenSlideConfig = {
|
|
/** Base public path for subpath hosting (leading + trailing slash). Default: '/'. */
|
|
base?: string;
|
|
/** Folder that contains your decks. Default: 'slides'. */
|
|
slidesDir?: string;
|
|
/** Folder that holds theme markdown + demo files. Default: 'themes'. */
|
|
themesDir?: string;
|
|
/** Folder for global assets shared across decks. Default: 'assets'. */
|
|
assetsDir?: string;
|
|
/** Dev server port. Default: first free port from 5173 upward. */
|
|
port?: number;
|
|
/** UI language for the runtime (home, inspector, presenter, etc.). */
|
|
locale?: Locale;
|
|
/** Build-time UI toggles. */
|
|
build?: OpenSlideBuildConfig;
|
|
};
|
|
```
|
|
|
|
## Common recipes
|
|
|
|
### Public share
|
|
|
|
```ts
|
|
const config: OpenSlideConfig = {
|
|
build: {
|
|
showSlideBrowser: false,
|
|
showSlideUi: false,
|
|
allowHtmlDownload: false,
|
|
},
|
|
};
|
|
```
|
|
|
|
### Host under a subpath
|
|
|
|
Set `base` to deploy the build under a sub-directory instead of the domain
|
|
root — GitHub Pages project sites, a reverse-proxy folder, an intranet path.
|
|
Use a leading and trailing slash:
|
|
|
|
```ts
|
|
const config: OpenSlideConfig = {
|
|
base: '/my-slides/',
|
|
};
|
|
```
|
|
|
|
The value is passed straight to Vite's `base` and to React Router's
|
|
`basename`, so client-side navigation matches the deployed path.
|
|
|
|
### Multiple deck folders
|
|
|
|
`slidesDir` is a single path today. If you want multiple roots, group them
|
|
under one folder and use subfolder ids.
|
|
|
|
### Switch the UI language
|
|
|
|
```ts
|
|
import { zhTW } from '@open-slide/core/locale';
|
|
|
|
const config: OpenSlideConfig = {
|
|
locale: zhTW,
|
|
};
|
|
```
|
|
|
|
See [Locale](/docs/reference/locale) for the full list of presets and how to
|
|
ship your own dictionary.
|