--- name: typo3-ddev-vite description: Integrate, maintain, or troubleshoot Vite-built CSS, SCSS, or CSS-in-JS and JavaScript in a TYPO3 site package running in DDEV. Use when installing or repairing praetorius/vite-asset-collector, vite-plugin-typo3, Vite, or ddev-vite-sidecar; adding a root vite.config.js; declaring Configuration/ViteEntrypoints.json; wiring a Fluid vite:asset ViewHelper; or diagnosing missing assets, manifests, dev-server loading, and stylesheet compilation. Supports both bk2k/bootstrap-package and typo3/cms-fluid-styled-content; use typo3-stylex for skom/stylex-connector setup or repair. license: CC-BY-4.0 compatibility: Requires a Composer-mode TYPO3 project with DDEV, a site package, and Node.js plus a supported package manager available in the DDEV web container. Dependency, DDEV add-on, configuration, source, and template changes require user authorization. --- # TYPO3 Vite in DDEV Set up or repair the Vite AssetCollector pipeline without coupling it to the selected content-rendering package. The pipeline belongs at the TYPO3 project root, while every participating extension owns its declared entrypoints and source files. ## 1. Discover the working shape Use read-only checks to identify the DDEV root and status, TYPO3 version, site-package path and extension key, root `composer.json`, root `package.json`/lockfile, package manager, `vite.config.*`, `.ddev/` add-ons, and existing Vite, AssetCollector, Fluid, and asset-loading configuration. Locate the actual page layout that renders ``. - Treat `bk2k/bootstrap-package` and `typo3/cms-fluid-styled-content` as rendering choices only. The Vite configuration, entrypoint file, and AssetCollector ViewHelper integration are the same for either choice. - Preserve a working package manager, lockfile, Vite configuration, entrypoint naming, and asset directory structure. Extend them instead of replacing them. - Check whether legacy CSS or JavaScript is already included through TypoScript, Fluid, or the base package. Plan one deliberate ownership path for each asset so the same bundle is not emitted twice. - If the site package, extension key, or page layout cannot be established from the project, ask for it before writing paths. Completion: the exact root command directory, site-package path, source entrypoint, rendered layout, and the missing or broken link in the pipeline are known. ## 2. Make the mutation boundary explicit Present the smallest required change set and obtain permission immediately before installing packages, adding the sidecar, changing lockfiles/configuration, or creating/editing site-package assets and Fluid templates. A repair begins with the evidence for the failed link rather than a broad reinstall. Typical writes include root `composer.json` and lockfiles, root Node manifests and lockfiles, `.ddev/`, root `vite.config.js`, `Configuration/ViteEntrypoints.json`, entrypoint/SCSS/JavaScript files, built assets, and a Fluid layout. Never commit generated output, change the production deployment process, or remove an existing asset path unless the user authorizes it. Completion: the approved change list is no larger than the identified gap. ## 3. Install the pipeline in DDEV Run dependency commands from the discovered project root through DDEV. Use the existing package manager and retain its lockfile. For a new standard setup, install: ```bash ddev composer require praetorius/vite-asset-collector # Base Vite setup (plain CSS, PostCSS, or CSS-in-JS): ddev exec npm install --save-dev vite vite-plugin-typo3 # If using SCSS, also add sass-embedded: ddev exec npm install --save-dev sass-embedded ``` For pnpm, Yarn, or Bun, use its equivalent development-dependency command rather than adding npm alongside it. Only install `sass-embedded` when the project specifically uses SCSS; projects using standard CSS custom properties, PostCSS, or CSS-in-JS (e.g. StyleX) do not require Sass. Keep Node dependencies at the project root, beside Composer dependencies, unless existing project evidence establishes a different frontend root. Install the sidecar only when it is absent: ```bash # DDEV 1.23.5+ ddev add-on get s2b/ddev-vite-sidecar # Older DDEV ddev get s2b/ddev-vite-sidecar ddev restart ``` Completion: Composer and Node manifests/lockfiles agree with the selected packages, and `ddev vite --help` is available from the frontend root. ## 4. Configure root Vite and site-package entrypoints Create or extend the project-root `vite.config.js`; preserve other plugins and intentional Vite settings. The minimal plugin configuration is: ```js import { defineConfig } from "vite"; import typo3 from "vite-plugin-typo3"; export default defineConfig({ plugins: [typo3()], }); ``` Declare the site package’s sources in `/Configuration/ViteEntrypoints.json`. Paths are relative to this JSON file. Prefer one JavaScript entrypoint that imports its stylesheet, so TYPO3 emits one coherent application bundle: ```json [ "../Resources/Private/JavaScript/Main.entry.js" ] ``` ```js // Resources/Private/JavaScript/Main.entry.js // 1. Primary stylesheet or design token / component styles import "../Styles/Main.scss"; // or "../CSS/main.css", or StyleX tokens/components // 2. Scoped Rich Text (RTE / CKEditor) and base frame styling import "../CSS/rte.css"; // 3. Application JavaScript starts here. ``` Keep imported stylesheets and JavaScript private source files. When decoupling from legacy CSS (such as omitting `typo3/fluid-styled-content-css`), user-generated CKEditor markup (`.ce-bodytext`, `

`, ``, `