Skip to content

refactor(pagebuilder): migrate to @puckeditor/core and auto-load module CSS - #10

Merged
antosubash merged 1 commit into
mainfrom
claude/hungry-newton
Mar 26, 2026
Merged

antosubash merged 1 commit into
mainfrom
claude/hungry-newton

Conversation

@antosubash

@antosubash antosubash commented Mar 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Migrate PageBuilder from deprecated @measured/puck@0.18 to @puckeditor/core@0.21 (package rename, same API)
  • Add automatic CSS injection in resolvePage() so modules no longer need to manually load their stylesheets
  • Delete puck/load-css.ts and all manual loadPuckCss() calls from Editor/Viewer components

What changed

packages/SimpleModule.Client/src/resolve-page.ts — ensureModuleCss() auto-injects a <link> tag for /_content/{ModuleName}/{modulename}.css before loading any module's pages. Uses onerror to silently handle modules without CSS. Idempotent via a Set.

modules/PageBuilder/src/PageBuilder/:

  • package.json — @measured/puck@^0.18.0 → @puckeditor/core@^0.21.1
  • All 14 source files — imports updated from @measured/puck to @puckeditor/core
  • Pages/index.ts — added import '@puckeditor/core/puck.css' (build-time CSS extraction)
  • puck/load-css.ts — deleted (no longer needed)
  • Views/Editor.tsx, Views/Viewer.tsx — removed loadPuckCss import and useEffect call

Test plan

  • npm run build --workspace=@simplemodule/pagebuilder builds without errors
  • dotnet build succeeds
  • PageBuilder Editor page loads with correct Puck styles (no unstyled flash)
  • PageBuilder Viewer page renders published pages with correct styles
  • Other modules (Products, Admin, etc.) still load correctly (CSS 404 handled silently)

🤖 Generated with Claude Code

…le CSS

Replace @measured/puck@0.18 with @puckeditor/core@0.21 (package rename,
same API). Add automatic CSS injection in resolvePage() so modules no
longer need to manually load their stylesheets at runtime.

- Update all imports from @measured/puck to @puckeditor/core
- CSS import path: @measured/puck/dist/index.css → @puckeditor/core/puck.css
- Move build-time CSS import to Pages/index.ts entry point
- Delete puck/load-css.ts and remove useEffect(loadPuckCss) from views
- ensureModuleCss() in resolve-page.ts handles CSS for all modules
@antosubash
antosubash force-pushed the claude/hungry-newton branch from 8371ba8 to ef1c429 Compare March 26, 2026 22:58
@antosubash
antosubash merged commit ef17674 into main Mar 26, 2026
2 checks passed
@antosubash
antosubash deleted the claude/hungry-newton branch March 26, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant