Context
A component package installed into a workspace (node_modules/<pkg>) can ship its classes but not their styles. buildScripts/build/themes.mjs compiles SCSS from exactly two roots (:23-27):
- the engine,
node_modules/neo.mjs/resources/scss;
- the workspace,
resources/scss.
getAllScssFiles() reads those two and no others (:144-154). A package's classes therefore render unstyled in every app that installs it, unless the app copies the package's SCSS into its own workspace.
Observed while building a grid extension package. Its row styles compile when the package's own repository is the workspace, for its demo, and never in an app that installs it.
The Problem
Packages are the engine's natural extension unit: classes on the dev-prefix import, the engine as a peer dependency. Styles are the one part a package cannot deliver. The guide describes theming as the engine plus the workspace overlay (learn/guides/uibuildingblocks/StylingAndTheming.md §8), so a third source has no place today.
The Architectural Reality
- Roots.
frameworkScssPath and workspaceScssPath (themes.mjs:23-24) feed both scssFolders, which supply the theme selection (:25-30), and getAllScssFiles() (:144-154). Same-path files from both roots merge, which is how the workspace overlay works.
- Output. Every compiled file lands in the workspace's
dist/<mode>/css/<target>/<relativePath> (:235) and in resources/theme-map.json (:29, :300). Neo.worker.App#insertThemeFiles() reads that map (src/worker/App.mjs:440-489), so package CSS compiled into the workspace needs no runtime change. Only the build has to find the SCSS.
- Runtime paths for packages. The App worker resolves the theme files of every class outside
Neo. under apps.<lowercased namespace root> (src/worker/App.mjs:455-463). A package's SCSS must therefore sit under resources/scss/src/apps/<root>/…. It works, and is noted only so the fix keeps it working.
The Fix
A package declares its SCSS root in its own package.json:
"neo": {"scss": "resources/scss"}The theme build adds one root per direct dependency of the workspace (dependencies and devDependencies) whose node_modules/<name>/package.json declares the field.
- Order: engine, packages, workspace. The workspace keeps the last word, as the overlay does today.
- No hard-coded pair.
scssFolders, themeFolders and getAllScssFiles() iterate the root list.
- Inside the engine repository (
insideNeo) the root list stays the engine alone.
Contract Ledger
| Target Surface |
Source of Authority |
Proposed Behavior |
Fallback |
Docs |
Evidence |
The neo.scss field in a dependency's package.json |
buildScripts/build/themes.mjs |
The named folder joins the build as an SCSS root, between the engine and the workspace |
Field absent: the dependency contributes nothing |
StylingAndTheming.md §8 |
themes.spec.mjs arms |
Decision Record impact: none.
Acceptance Criteria
Out of Scope
- How the App worker maps non-
Neo. namespaces to apps.* theme paths.
- The dev server's theme-freshness check (
buildScripts/webpack/webpack.server.config.mjs, see #20132) watching package roots.
- Shipping prebuilt CSS inside packages.
Avoided Traps
- Scanning every
node_modules/*/resources/scss. It needs no configuration, but it compiles any dependency's SCSS by accident, at every dependency's cost.
- Workspace-declared package lists (
"neo": {"scssPackages": […]} in the app). Explicit, but every consumer must configure every package; the package already knows where its styles are.
Related
#3638 (merged): the workspace and framework theme folders are merged for selection.
#20132: the dev server's theme check in workspaces.
Live latest-open + closed sweep: checked latest 20 open + closed searches (theme build, package SCSS, node_modules, build-themes dependency) at 2026-11-03T18:2xZ. Out of Scope read on #20132; no equivalent or prior exclusion found. KB / Memory Core: no prior decision. A2A, last 30 messages: no claim on this scope. Own assignments: none on this surface.
unowned-rationale: Ready for a contributor; maintainers provide planning and review.
Origin Session ID: 9ae27458-df2a-4524-94e3-65fb2a075f3d
Retrieval Hint: "theme build package scss root neo.scss package.json field"
Context
A component package installed into a workspace (
node_modules/<pkg>) can ship its classes but not their styles.buildScripts/build/themes.mjscompiles SCSS from exactly two roots (:23-27):node_modules/neo.mjs/resources/scss;resources/scss.getAllScssFiles()reads those two and no others (:144-154). A package's classes therefore render unstyled in every app that installs it, unless the app copies the package's SCSS into its own workspace.Observed while building a grid extension package. Its row styles compile when the package's own repository is the workspace, for its demo, and never in an app that installs it.
The Problem
Packages are the engine's natural extension unit: classes on the dev-prefix import, the engine as a peer dependency. Styles are the one part a package cannot deliver. The guide describes theming as the engine plus the workspace overlay (
learn/guides/uibuildingblocks/StylingAndTheming.md§8), so a third source has no place today.The Architectural Reality
frameworkScssPathandworkspaceScssPath(themes.mjs:23-24) feed bothscssFolders, which supply the theme selection (:25-30), andgetAllScssFiles()(:144-154). Same-path files from both roots merge, which is how the workspace overlay works.dist/<mode>/css/<target>/<relativePath>(:235) and inresources/theme-map.json(:29,:300).Neo.worker.App#insertThemeFiles()reads that map (src/worker/App.mjs:440-489), so package CSS compiled into the workspace needs no runtime change. Only the build has to find the SCSS.Neo.underapps.<lowercased namespace root>(src/worker/App.mjs:455-463). A package's SCSS must therefore sit underresources/scss/src/apps/<root>/…. It works, and is noted only so the fix keeps it working.The Fix
A package declares its SCSS root in its own
package.json:"neo": {"scss": "resources/scss"}The theme build adds one root per direct dependency of the workspace (
dependenciesanddevDependencies) whosenode_modules/<name>/package.jsondeclares the field.scssFolders,themeFoldersandgetAllScssFiles()iterate the root list.insideNeo) the root list stays the engine alone.Contract Ledger
neo.scssfield in a dependency'spackage.jsonbuildScripts/build/themes.mjsStylingAndTheming.md§8themes.spec.mjsarmsDecision Record impact: none.
Acceptance Criteria
"neo": {"scss": "resources/scss"}compiles that package'ssrcSCSS into the workspace'sdist/development/cssand lists its classes inresources/theme-map.json.theme-neo-dark) joins the theme selection and the build, as a workspace's does (see the#3638arm).node_modulesbroadly.test/playwright/unit/buildScripts/build/themes.spec.mjscovers the above with the real CLI on a tmp workspace holding the engine, one declaring package and one non-declaring package. Run it withnpx playwright test -c test/playwright/playwright.config.unit.mjs test/playwright/unit/buildScripts/build/themes.spec.mjs.StylingAndTheming.md§8 documents the field.Out of Scope
Neo.namespaces toapps.*theme paths.buildScripts/webpack/webpack.server.config.mjs, see#20132) watching package roots.Avoided Traps
node_modules/*/resources/scss. It needs no configuration, but it compiles any dependency's SCSS by accident, at every dependency's cost."neo": {"scssPackages": […]}in the app). Explicit, but every consumer must configure every package; the package already knows where its styles are.Related
#3638(merged): the workspace and framework theme folders are merged for selection.#20132: the dev server's theme check in workspaces.Live latest-open + closed sweep: checked latest 20 open + closed searches (theme build, package SCSS,
node_modules,build-themesdependency) at 2026-11-03T18:2xZ. Out of Scope read on#20132; no equivalent or prior exclusion found. KB / Memory Core: no prior decision. A2A, last 30 messages: no claim on this scope. Own assignments: none on this surface.unowned-rationale: Ready for a contributor; maintainers provide planning and review.
Origin Session ID: 9ae27458-df2a-4524-94e3-65fb2a075f3d
Retrieval Hint: "theme build package scss root neo.scss package.json field"