feat: add Bricks Builder integration plugin - #71
Conversation
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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis 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. ChangesSLASHED for Bricks Builder Integration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
integrations/bricks/README.md (1)
126-135: ⚡ Quick winAdd 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
📒 Files selected for processing (7)
integrations/bricks/README.mdintegrations/bricks/assets/editor.cssintegrations/bricks/includes/class-classes.phpintegrations/bricks/includes/class-colors.phpintegrations/bricks/includes/class-enqueue.phpintegrations/bricks/includes/class-variables.phpintegrations/bricks/slashed-bricks.php
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
integrations/bricks/includes/class-enqueue.phpintegrations/bricks/slashed-bricks.php
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
slashed.optimal.csson frontend and within the Bricks editor iframe via a singlewp_enqueue_scriptshook.sf-*) and ~40 state classes (.is-*) registered as locked global classes in Bricks' class pickervar()references (adapts to dark mode)Architecture
Customization
All behavior is filterable:
slashed_bricks/css_bundle_url- override which CSS bundle to loadslashed_bricks/registered_classes- filter class listslashed_bricks/registered_colors- filter colorsslashed_bricks/registered_variables- filter variablesslashed_bricks/color_categories- filter color categoriesRequirements
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