|
@@ -366,11 +366,17 @@ interface ResolveAliasConfig {
|
|
|
- Collects all `src/**/*.vendor-styles.ts` as entry points via `fs.globSync`
|
|
- Collects all `src/**/*.vendor-styles.ts` as entry points via `fs.globSync`
|
|
|
- Outputs to `src/` preserving directory structure, with `.vendor-styles.prebuilt.js` suffix
|
|
- Outputs to `src/` preserving directory structure, with `.vendor-styles.prebuilt.js` suffix
|
|
|
- Uses `rollupOptions.input` (not `lib.entry`) for multi-entry compilation
|
|
- Uses `rollupOptions.input` (not `lib.entry`) for multi-entry compilation
|
|
|
|
|
+- Includes `moveAssetsToPublic` Vite plugin that runs at `closeBundle`:
|
|
|
|
|
+ 1. Moves emitted font/asset files from `src/assets/` to `public/static/fonts/`
|
|
|
|
|
+ 2. Rewrites `/assets/` → `/static/fonts/` URL references in all `.vendor-styles.prebuilt.js` files
|
|
|
|
|
+ 3. Removes the temporary `src/assets/` directory
|
|
|
|
|
+- Fonts are served at `/static/fonts/*` via the existing `express.static(crowi.publicDir)` route (which serves `public/` at `/`)
|
|
|
|
|
+- `/public/static/fonts` is git-ignored (build artifact, regenerated by `pre:styles-components`)
|
|
|
|
|
|
|
|
**Turborepo Integration**
|
|
**Turborepo Integration**
|
|
|
- `pre:styles-components` / `dev:pre:styles-components` tasks added as dependencies of `build` and `dev`
|
|
- `pre:styles-components` / `dev:pre:styles-components` tasks added as dependencies of `build` and `dev`
|
|
|
- Inputs: `vite.vendor-styles-components.ts`, `src/**/*.vendor-styles.ts`, `package.json`
|
|
- Inputs: `vite.vendor-styles-components.ts`, `src/**/*.vendor-styles.ts`, `package.json`
|
|
|
-- Outputs: `src/**/*.vendor-styles.prebuilt.js`
|
|
|
|
|
|
|
+- Outputs: `src/**/*.vendor-styles.prebuilt.js`, `public/static/fonts/**`
|
|
|
|
|
|
|
|
**Vendor-Styles Entry Points (8 files covering 13 CSS imports)**
|
|
**Vendor-Styles Entry Points (8 files covering 13 CSS imports)**
|
|
|
|
|
|
|
@@ -392,6 +398,7 @@ interface ResolveAliasConfig {
|
|
|
- Multiple CSS imports for the same component are combined in a single entry point (e.g., `Renderer.vendor-styles.ts` imports 3 CSS files)
|
|
- Multiple CSS imports for the same component are combined in a single entry point (e.g., `Renderer.vendor-styles.ts` imports 3 CSS files)
|
|
|
- Shared entry points (e.g., `GrowiEditor.vendor-styles.ts`) are referenced from multiple components via relative path
|
|
- Shared entry points (e.g., `GrowiEditor.vendor-styles.ts`) are referenced from multiple components via relative path
|
|
|
- SSR note: CSS is injected at runtime via `<style>` tags, so it is not available during SSR. Most consuming components already use `next/dynamic` with `ssr: false`, avoiding FOUC
|
|
- SSR note: CSS is injected at runtime via `<style>` tags, so it is not available during SSR. Most consuming components already use `next/dynamic` with `ssr: false`, avoiding FOUC
|
|
|
|
|
+- **Font/asset handling**: When vendor CSS references external assets (e.g., KaTeX's `@font-face` declarations referencing `fonts/KaTeX_*.woff2`), Vite emits them to `src/assets/` during build. The `moveAssetsToPublic` plugin then relocates these to `public/static/fonts/` and rewrites the URL references in prebuilt JS to `/static/fonts/...`. This ensures fonts are served by the existing Express static file middleware without additional server configuration.
|
|
|
|
|
|
|
|
#### GlobalSyntaxConversion — `:global` Block-to-Function Form
|
|
#### GlobalSyntaxConversion — `:global` Block-to-Function Form
|
|
|
|
|
|