Skip to content

feat: builder-agnostic CSS delivery and de-Bricks admin UI - #170

Merged
jackgranatowski merged 2 commits into
mainfrom
claude/gutenberg-integration-scope-jSOZX
May 31, 2026
Merged

feat: builder-agnostic CSS delivery and de-Bricks admin UI#170
jackgranatowski merged 2 commits into
mainfrom
claude/gutenberg-integration-scope-jSOZX

Conversation

@jackgranatowski

@jackgranatowski jackgranatowski commented May 31, 2026

Copy link
Copy Markdown
Contributor

Summary

SLASHED is a CSS framework, not a Bricks tool. This PR makes the core CSS delivery work on any WordPress site — custom theme, classic theme, or no page builder at all — and removes Bricks branding from every shared admin surface.

CSS delivery is now global

  • New includes/class-core-enqueue.php (Slashed_Core_Enqueue): registers and enqueues slashed-framework on wp_enqueue_scripts (frontend) and enqueue_block_editor_assets (block editor) regardless of which builder, if any, is active. Skips bricks_is_builder_main() to protect Bricks' panel UI.
  • html_font_size override moved from the Bricks enqueue class into Slashed_Core_Enqueue — it's a global token setting, not Bricks-specific.
  • slashed.php instantiates Slashed_Core_Enqueue unconditionally, before any integration bootstrap.
  • Standalone Bricks plugin bootstrap updated to also load and instantiate Slashed_Core_Enqueue (plus class-settings.php and class-css-loader.php).

Bricks integration simplified

Slashed_Bricks_Enqueue now only adds the Bricks dark-mode bridge inline style ([data-brx-theme]--sf-is-dark). Framework handle registration and font-size injection are handled globally.

Admin page restructured

Before After
"Active integrations" — implied CSS only loads with a builder "CSS framework" — explains CSS loads on any site, no builder required
"Manage Bricks token overrides →" → broken link (slashed-bricks) "Customize design tokens →" → correct link (slashed-tokens)
Bundle selector under integrations Bundle selector under CSS framework section
"Gutenberg: Loads SLASHED CSS in the block editor" "Gutenberg: Syncs colors with editor palette and bridges dark-mode"

Token editor de-Brickification

  • slashedBricksAppslashedApp (PHP wp_localize_script + SPA source + compiled bundle)
  • Script/style handles slashed-bricks-admin-appslashed-admin-app
  • SPA source comments updated (main.js, api.js, stores.svelte.js)
  • Bundle rebuilt

Test plan

  • Custom theme (no Bricks, no Gutenberg, both integrations disabled): SLASHED CSS loads on frontend
  • Bricks enabled: dark-mode bridge works; CSS loads in canvas iframe; does NOT load in builder panel
  • Gutenberg enabled: CSS loads in block editor canvas
  • Token editor opens without JS errors; saves/resets work (slashed/v1 endpoints)
  • "Customize design tokens →" link on settings page navigates to the Tokens page
  • Standalone Bricks plugin (no unified slashed.php): CSS loads, token editor accessible

https://claude.ai/code/session_01DU3r3kT7GqH7w7jeadV2DT


Generated by Claude Code

Summary by CodeRabbit

  • UI & Settings
    • Reorganized admin settings page with new dedicated "CSS framework" section featuring a design token customization link.
    • Updated builder integration section labels and descriptions for clarity.
    • Removed the builder integration management link from specific conditions.

SLASHED is a CSS framework, not a Bricks tool. This commit makes the
core CSS delivery work on any WordPress site — custom theme, classic
theme, or no page builder — and removes Bricks branding from the
shared admin surfaces.

CSS delivery
- Add includes/class-core-enqueue.php (Slashed_Core_Enqueue): always
  enqueues `slashed-framework` on wp_enqueue_scripts and
  enqueue_block_editor_assets, independent of any builder integration.
  Includes the html_font_size override (moved from Bricks enqueue).
  Skips bricks_is_builder_main() context to protect Bricks' panel UI.
- slashed.php: instantiate Slashed_Core_Enqueue unconditionally, before
  integration bootstraps.
- slashed-bricks.php standalone: load class-settings.php,
  class-css-loader.php, class-core-enqueue.php and instantiate
  Slashed_Core_Enqueue so the standalone Bricks plugin also gets the
  global CSS pipeline.

Bricks integration cleanup
- class-enqueue.php: remove framework handle registration and
  html_font_size injection (both now handled by Slashed_Core_Enqueue).
  Bricks enqueue now only adds the dark-mode bridge inline style.

Admin page restructure (class-admin.php)
- Renamed "Active integrations" section to "CSS framework" — explains
  that CSS loads automatically on any site, no builder required.
- Added "Customize design tokens →" link pointing to slashed-tokens
  (fixes broken link that previously pointed to non-existent slashed-bricks).
- Moved bundle selector into the CSS framework section.
- Renamed second section to "Builder integrations (optional)" with
  accurate descriptions of what each integration actually adds.

Token editor de-Brickification (class-token-page.php + SPA)
- Renamed wp_localize_script global: slashedBricksApp → slashedApp
- Renamed script/style handles: slashed-bricks-admin-app → slashed-admin-app
- Updated SPA source (stores.svelte.js, main.js, api.js) to reference
  window.slashedApp and slashed/v1 endpoints
- Rebuilt compiled bundle (assets/admin-app/app.js)

https://claude.ai/code/session_01DU3r3kT7GqH7w7jeadV2DT
@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jackgranatowski, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 52 minutes and 39 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5f74295a-4b27-4b62-afe3-acda0c085cc5

📥 Commits

Reviewing files that changed from the base of the PR and between e8e9208 and efae784.

📒 Files selected for processing (2)
  • includes/class-core-enqueue.php
  • integrations/bricks/admin-app/index.html
📝 Walkthrough

Walkthrough

This PR refactors CSS framework delivery by introducing a new builder-agnostic Slashed_Core_Enqueue class, reorganizing the bootstrap pipeline in both the main plugin and Bricks standalone mode to use it, simplifying the Bricks-specific enqueue method, renaming admin app handles to remove builder-specific naming, and restructuring the admin settings page UI.

Changes

Core CSS Enqueue and Bootstrap Reorganization

Layer / File(s) Summary
Core CSS Enqueue class implementation
includes/class-core-enqueue.php
New Slashed_Core_Enqueue class handles enqueueing slashed-framework on frontend and block editor, retrieves URLs from Slashed_CSS_Loader, guards against Bricks builder context, and optionally injects font-size overrides per plugin settings.
Bootstrap order refactor in main plugin and Bricks standalone
slashed.php, integrations/bricks/slashed-bricks.php
slashed.php introduces a core CSS delivery block that instantiates Slashed_Core_Enqueue() before token infrastructure; Bricks standalone mode loads shared infrastructure and instantiates the same class to unify CSS delivery across both plugin modes.
Bricks enqueue method simplification
integrations/bricks/includes/class-enqueue.php
Slashed_Bricks_Enqueue::enqueue_frontend_styles() removes CSS URL resolution and font-size injection (now in core), keeping only the builder-context guard and dark-mode inline bridge for the globally-registered slashed-framework handle.

Admin App Handle and Global Object Rename

Layer / File(s) Summary
Admin app enqueue and localization in token page
includes/class-token-page.php
Updates enqueue calls to use slashed-admin-app handle, localizes data onto the new handle under slashedApp global, updates mark_as_module() handle check, and rewords the missing-bundle notice.
Admin app JavaScript bootstrap and store hydration
integrations/bricks/admin-app/src/lib/api.js, integrations/bricks/admin-app/src/lib/stores.svelte.js, integrations/bricks/admin-app/src/main.js
Updates files to read from window.slashedApp instead of builder-specific global, reference the slashed REST namespace and nonce source, and document token option shape as slashed_tokens.

Admin Settings Page UI Reorganization

Layer / File(s) Summary
Settings page structure and integration descriptions
includes/class-admin.php
Adds dedicated CSS framework section with design-token link, updates builder integrations heading/description, removes Bricks token override link, and updates Gutenberg integration copy.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • codeslash-dev/SLASHED#169: This PR's refactoring that centralizes token infrastructure and override CSS delivery in the global slashed.php pipeline aligns directly with the main PR's core enqueue centralization.
  • codeslash-dev/SLASHED#71: Main PR's refactor of the Bricks integration bootstrap and enqueue flow builds on the Bricks Builder integration introduced in PR #71.
  • codeslash-dev/SLASHED#168: The main PR's new Slashed_Core_Enqueue that uses Slashed_CSS_Loader for CSS bundle URL/version resolution overlaps with PR #168's shared Gutenberg/unified setup around the same loader class.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly summarizes the main changes: builder-agnostic CSS delivery (via Slashed_Core_Enqueue) and de-Bricks admin UI (renamed globals, restructured admin sections, simplified Bricks integration).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/gutenberg-integration-scope-jSOZX

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
includes/class-token-page.php (1)

100-118: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update the remaining legacy global reference in the Bricks dev harness.

includes/class-token-page.php now consistently enqueues/localizes slashed-admin-app / slashedApp, and repo searches show no remaining PHP/JS/TS references to slashed-bricks-admin-app or window.slashedBricksApp for runtime.
However, integrations/bricks/admin-app/index.html (dev harness) still sets window.slashedBricksApp, which won’t match the current window.slashedApp-based hydration—so adjust it to slashedApp to avoid silent breakage in the dev harness.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@includes/class-token-page.php` around lines 100 - 118, Replace the legacy
global window.slashedBricksApp in the Bricks dev harness HTML with the current
global name window.slashedApp so the localized object used by the enqueued
script ('slashed-admin-app' / 'slashedApp') is matched at runtime; locate the
dev harness index.html code that sets window.slashedBricksApp and change the
assignment/initialization to window.slashedApp (preserving the same
shape/fields), and also update any boot/hydration references that read
window.slashedBricksApp so they read window.slashedApp instead.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@includes/class-core-enqueue.php`:
- Around line 67-73: The editor stylesheet enqueuing in enqueue_editor() omits
the html font-size override that enqueue_frontend() injects, causing rem-based
sizing to differ in the block editor; update enqueue_editor() (and related
editor registration code) to apply the same html_font_size override (the
injected rule like "html { font-size: 62.5% !important; }" or 100%) when
registering/enqueuing the 'slashed-framework' stylesheet for the block editor
iframe so the editor canvas matches the frontend; ensure this only targets the
editor canvas (iframe) in supported WP versions (block editor is iframed in WP
6.4+) or add a short comment explaining deliberate omission if you intentionally
want to avoid affecting wp-admin chrome.

---

Outside diff comments:
In `@includes/class-token-page.php`:
- Around line 100-118: Replace the legacy global window.slashedBricksApp in the
Bricks dev harness HTML with the current global name window.slashedApp so the
localized object used by the enqueued script ('slashed-admin-app' /
'slashedApp') is matched at runtime; locate the dev harness index.html code that
sets window.slashedBricksApp and change the assignment/initialization to
window.slashedApp (preserving the same shape/fields), and also update any
boot/hydration references that read window.slashedBricksApp so they read
window.slashedApp instead.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 251c6956-e382-489f-882f-ba24f4d14c44

📥 Commits

Reviewing files that changed from the base of the PR and between 1403dfd and e8e9208.

📒 Files selected for processing (10)
  • includes/class-admin.php
  • includes/class-core-enqueue.php
  • includes/class-token-page.php
  • integrations/bricks/admin-app/src/lib/api.js
  • integrations/bricks/admin-app/src/lib/stores.svelte.js
  • integrations/bricks/admin-app/src/main.js
  • integrations/bricks/assets/admin-app/app.js
  • integrations/bricks/includes/class-enqueue.php
  • integrations/bricks/slashed-bricks.php
  • slashed.php

Comment thread includes/class-core-enqueue.php
- class-core-enqueue: enqueue_editor() now injects the same
  html { font-size } override as enqueue_frontend() so the iframed
  editor canvas renders rem-based values at the same root size as the
  public site (block editor is always iframed in WP 6.4+, our minimum)

- admin-app/index.html: rename window.slashedBricksApp → window.slashedApp
  in the Vite dev harness to match the renamed wp_localize_script global

https://claude.ai/code/session_01DU3r3kT7GqH7w7jeadV2DT
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.

2 participants