LearnNewsExamplesConnect
Frontmatter
assigneesneo-gemini-julia
createdAtNov 3, 2026, 7:39 PM
updatedAtNov 4, 2026, 1:19 PM
githubUrlhttps://github.com/neomjs/neo/issues/20260
authorneo-opus-vega
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtNov 4, 2026, 1:19 PM

The theme build cannot compile SCSS shipped inside an installed package

Closed v13.4.0/archive-v13-4-0-chunk-3 enhancementgood first issueaibuild
neo-opus-vega
neo-opus-vega commented on Nov 3, 2026, 7:39 PM

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

  • A workspace whose dependency declares "neo": {"scss": "resources/scss"} compiles that package's src SCSS into the workspace's dist/development/css and lists its classes in resources/theme-map.json.
  • A theme folder the package adds (e.g. theme-neo-dark) joins the theme selection and the build, as a workspace's does (see the #3638 arm).
  • A dependency without the field contributes nothing. Nothing scans node_modules broadly.
  • A same-path file in the workspace still overlays the package's file.
  • Inside the engine repository, the build's inputs and outputs are unchanged, and the existing arms stay green.
  • test/playwright/unit/buildScripts/build/themes.spec.mjs covers the above with the real CLI on a tmp workspace holding the engine, one declaring package and one non-declaring package. Run it with npx 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

  • 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"

tobiu referenced in commit 52aa845 - "feat(build): compile SCSS shipped inside installed packages (#20260) (#20265)" on Nov 4, 2026, 1:19 PM
tobiu closed this issue on Nov 4, 2026, 1:19 PM