Skip to content

feat: add Bricks Builder integration plugin - #71

Merged
jackgranatowski merged 5 commits into
mainfrom
feat/bricks-integration
May 23, 2026
Merged

feat: add Bricks Builder integration plugin#71
jackgranatowski merged 5 commits into
mainfrom
feat/bricks-integration

Conversation

@kiro-agent

@kiro-agent kiro-agent Bot commented May 23, 2026

Copy link
Copy Markdown

This pull request was created by @kiro-agent on behalf of @jackgranatowski 👻

Comment with /kiro fix to address specific feedback or /kiro all to address everything.
Learn about Kiro autonomous agent


Summary

Adds a WordPress plugin at integrations/bricks/ that natively integrates SLASHED with Bricks Builder, providing the same type of in-builder experience that Automatic CSS and Core Framework offer.

What's included

  • CSS Enqueue - Loads slashed.optimal.css on frontend and within the Bricks editor iframe via a single wp_enqueue_scripts hook
  • Variable Registration - 200+ CSS custom properties organized by category (Colors, Spacing, Typography, Layout, Radius, Shadows, Motion, Z-Index) registered for Bricks' code editor autocomplete
  • Class Autocomplete - ~140 layout classes (.sf-*) and ~40 state classes (.is-*) registered as locked global classes in Bricks' class picker
  • Color Palette Sync - Brand scales (6 palettes x 11 steps), status colors, and semantic colors injected into Bricks' global color palette using var() references (adapts to dark mode)

Architecture

integrations/bricks/
  slashed-bricks.php            Bootstrap (Bricks guard, constants, loader)
  includes/class-enqueue.php    CSS enqueue for frontend + editor iframe
  includes/class-variables.php  Variable picker + code autocomplete
  includes/class-classes.php    Class autocomplete registration
  includes/class-colors.php     Color palette synchronization
  assets/editor.css             Editor panel styling placeholder
  README.md                     Installation & filter hook docs

Customization

All behavior is filterable:

  • slashed_bricks/css_bundle_url - override which CSS bundle to load
  • slashed_bricks/registered_classes - filter class list
  • slashed_bricks/registered_colors - filter colors
  • slashed_bricks/registered_variables - filter variables
  • slashed_bricks/color_categories - filter color categories

Requirements

  • WordPress 6.0+
  • PHP 7.4+
  • Bricks Builder 1.9.2+

Testing

Manual testing in a WordPress environment with Bricks active. The plugin guards against activation without Bricks and shows an admin notice if Bricks is not detected.

Summary by CodeRabbit

  • New Features
    • SLASHED CSS integration for Bricks Builder with install/activation checks
    • Class autocomplete for layout and state utilities in the builder
    • Global color palette (brand, semantic, status) available in editor
    • Categorized CSS variable pickers and editor autocomplete signatures
    • Automatic stylesheet loading for frontend and editor, with bundle switching option
  • Documentation
    • Added README and editor panel notes explaining features, configuration, and MIT license

Review Change Stack

kiro-agent and others added 3 commits May 23, 2026 13:39
Create a WordPress plugin at integrations/bricks/ that integrates the
SLASHED CSS framework with Bricks Builder, providing:

- CSS enqueue on frontend and editor iframe (class-enqueue.php)
- CSS variable registration for builder pickers (class-variables.php)
- Layout and state class autocomplete (class-classes.php)
- Color palette synchronization with CSS var references (class-colors.php)
- Filter hooks for all registration arrays
- Editor panel styling and documentation

Co-authored-by: Jack Granatowski <contact@codeslash.net>
… SLASHED tokens

Co-authored-by: Jack Granatowski <contact@codeslash.net>
- Fix CSS bundle URL to check both symlink and copy-install paths
- Use 'raw' instead of 'hex' for color entries with var() references
- Replace editor.css non-existent selectors with empty placeholder
- Add filemtime-based cache-busting for CSS bundle version
- Add docblock explaining variable picker mechanism in class-variables
- Update README with copy-install CSS bundle instructions

Co-authored-by: Jack Granatowski <contact@codeslash.net>
@coderabbitai

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9d47cc6c-71d1-4ccd-a412-12dca967a21e

📥 Commits

Reviewing files that changed from the base of the PR and between a00858e and 7657e0c.

📒 Files selected for processing (1)
  • integrations/bricks/slashed-bricks.php

📝 Walkthrough

Walkthrough

This PR introduces a complete WordPress plugin integration that bootstraps SLASHED CSS framework support into Bricks Builder, providing CSS enqueuing with cache busting, variable picker registration with autocomplete, class and color palette definitions, and conditional initialization with dependency detection.

Changes

SLASHED for Bricks Builder Integration

Layer / File(s) Summary
Plugin bootstrap and initialization
integrations/bricks/slashed-bricks.php
Defines plugin constants, CSS URL resolution with fallback layout detection, Bricks availability detection, hooks conditional integration class loading onto after_setup_theme, and registers admin notice when Bricks is inactive.
CSS bundle enqueuing
integrations/bricks/includes/class-enqueue.php
Enqueues the main SLASHED CSS bundle on frontend and editor with filemtime-based cache busting, and conditionally loads editor-only stylesheet when bricks_is_builder_main() is true.
CSS variable picker and autocomplete registration
integrations/bricks/includes/class-variables.php
Registers eight categories of SLASHED CSS custom properties (Colors, Spacing, Typography, Layout, Radius, Shadows, Motion, Z-Index) into Bricks variable pickers and code editor autocomplete with i18n labels and enumeration helpers.
Class autocomplete and global classes registration
integrations/bricks/includes/class-classes.php
Registers SLASHED layout and state utility classes into Bricks global locked classes for builder class selection and autocomplete with Bricks-compatible entry structures.
Color palette registration
integrations/bricks/includes/class-colors.php
Registers SLASHED color tokens—brand palettes with scale steps, status colors, and semantic tokens—into Bricks global colors using CSS variable references and category grouping.
Documentation and static assets
integrations/bricks/README.md, integrations/bricks/assets/editor.css
Plugin README documenting supported requirements, installation methods (copy vs symlink), configurable filter hooks, architecture overview, and MIT license; editor stylesheet placeholder for future Bricks admin panel styles.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: adding a WordPress plugin that integrates SLASHED with Bricks Builder, which is the primary focus of all changes across the entire changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/bricks-integration

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: 3

🧹 Nitpick comments (1)
integrations/bricks/README.md (1)

126-135: ⚡ Quick win

Add language identifier to fenced code block.

The architecture diagram uses a fenced code block without a language specifier. Adding a language identifier improves rendering and satisfies markdown linting rules.

📝 Proposed fix
-```
+```text
 integrations/bricks/
   slashed-bricks.php            Main plugin bootstrap (guards, constants, loader)

As per coding guidelines, the markdownlint tool flagged this as MD040 (fenced-code-language).

🤖 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 `@integrations/bricks/README.md` around lines 126 - 135, The fenced code block
in README.md that contains the directory listing (the block starting with ```
and the lines like "integrations/bricks/" and "slashed-bricks.php") lacks a
language identifier and triggers markdownlint MD040; update the opening fence to
include a language (e.g., change ``` to ```text) so the block is explicitly
marked as plain text and linting will pass.
🤖 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 `@integrations/bricks/includes/class-enqueue.php`:
- Around line 37-58: The enqueue_frontend_styles method should bail out when
slashed_bricks_get_css_url() returns an empty string to avoid registering a
broken stylesheet; update enqueue_frontend_styles to check the $css_url result
right after assignment and return early (no wp_enqueue_style call) if it's
empty/falsey, while keeping the existing versioning logic
(repo_path/local_path/version) intact and still computing $version only when a
valid $css_url exists.

In `@integrations/bricks/slashed-bricks.php`:
- Around line 90-107: Add an activation-time guard by registering an activation
hook (use register_activation_hook) that calls a new function (e.g.,
slashed_bricks_activation_check) which uses the existing
slashed_bricks_is_bricks_active() and checks Bricks version >= 1.9.2; if the
check fails call deactivate_plugins( plugin_basename( __FILE__ ) ) (and for
multisite use deactivate_plugins with network handling) and abort activation
with wp_die() showing a clear message about the Bricks requirement. Place the
register_activation_hook and slashed_bricks_activation_check in
integrations/bricks/slashed-bricks.php near slashed_bricks_init() so the
activation-phase guard runs before the plugin stays active.
- Around line 73-84: The function slashed_bricks_is_bricks_active() currently
returns true if BRICKS_VERSION is defined regardless of version; change the
BRICKS_VERSION check to ensure the installed Bricks meets the minimum required
version 1.9.2 by using PHP's version_compare (i.e. replace the unconditional
defined('BRICKS_VERSION') branch with a check like defined('BRICKS_VERSION') &&
version_compare(BRICKS_VERSION, '1.9.2', '>=')), keeping the existing theme
name/template checks intact so the function only returns true when Bricks is
active and at least 1.9.2.

---

Nitpick comments:
In `@integrations/bricks/README.md`:
- Around line 126-135: The fenced code block in README.md that contains the
directory listing (the block starting with ``` and the lines like
"integrations/bricks/" and "slashed-bricks.php") lacks a language identifier and
triggers markdownlint MD040; update the opening fence to include a language
(e.g., change ``` to ```text) so the block is explicitly marked as plain text
and linting will pass.
🪄 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: 80898fd1-552d-41c4-959e-27ae65b3b84a

📥 Commits

Reviewing files that changed from the base of the PR and between c081d59 and 56c98b1.

📒 Files selected for processing (7)
  • integrations/bricks/README.md
  • integrations/bricks/assets/editor.css
  • integrations/bricks/includes/class-classes.php
  • integrations/bricks/includes/class-colors.php
  • integrations/bricks/includes/class-enqueue.php
  • integrations/bricks/includes/class-variables.php
  • integrations/bricks/slashed-bricks.php

Comment thread integrations/bricks/includes/class-enqueue.php
Comment thread integrations/bricks/slashed-bricks.php
Comment thread integrations/bricks/slashed-bricks.php

@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

🤖 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 `@integrations/bricks/slashed-bricks.php`:
- Around line 73-83: When the active theme is a Bricks child theme
slashed_bricks_is_bricks_active() is comparing the child theme's Version,
causing version gating to fail; update the function to, when
wp_get_theme()->get_template() equals 'bricks', call wp_get_theme(
$theme->get_template() ) to load the parent Bricks theme and use that parent
theme's Version in version_compare against the minimum_version ('1.9.2'); keep
the existing BRICKS_VERSION fallback (version_compare(BRICKS_VERSION,
$minimum_version, '>=')) for cases where the constant is defined.
🪄 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: e49ad072-2d5a-4e1b-a057-6bf0df2efec0

📥 Commits

Reviewing files that changed from the base of the PR and between 56c98b1 and a00858e.

📒 Files selected for processing (2)
  • integrations/bricks/includes/class-enqueue.php
  • integrations/bricks/slashed-bricks.php

Comment thread integrations/bricks/slashed-bricks.php
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