Skip to content

feat: use jsDelivr CDN as default CSS source for Bricks - #74

Merged
jackgranatowski merged 1 commit into
mainfrom
feat/bricks-jsdelivr-default
May 23, 2026
Merged

feat: use jsDelivr CDN as default CSS source for Bricks#74
jackgranatowski merged 1 commit into
mainfrom
feat/bricks-jsdelivr-default

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

Changes the default CSS source for the Bricks Builder integration plugin to load from jsDelivr CDN instead of requiring local files.

Default URL: https://cdn.jsdelivr.net/gh/codeslash-dev/SLASHED@main/dist/slashed.optimal.css

Changes

  • slashed_bricks_get_css_url() now defaults to jsDelivr CDN (main branch latest)
  • Local files (symlink/in-repo or dist/ folder) still take precedence if present
  • Removed trigger_error fallback since CDN always provides a working default
  • Updated README to reflect the new zero-config installation experience

Behavior

  1. Default - Loads from jsDelivr (always tracks latest main branch)
  2. Local override - If local files are detected, uses those instead
  3. Filter override - slashed_bricks/css_bundle_url filter still available

This means users can activate the plugin immediately without copying any CSS files.

Summary by CodeRabbit

  • Documentation

    • Updated installation and CSS bundle documentation to clarify CDN-based default delivery and local file precedence options.
  • Features

    • Plugin now defaults to serving CSS bundles from CDN with automatic fallback to local files when available.

Review Change Stack

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

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The PR updates the Bricks integration's CSS bundle loading mechanism to default to the jsDelivr CDN instead of requiring a local dist/ file, while preserving the ability for local bundles to override the CDN. Both the implementation and documentation are aligned to reflect this new behavior.

Changes

CSS Bundle CDN Default

Layer / File(s) Summary
CSS Bundle URL resolution
integrations/bricks/slashed-bricks.php
The slashed_bricks_get_css_url() function initializes to the jsDelivr CDN endpoint, checks for local dist/ files in two locations (symlink/in-repo and copy-install), applies local precedence when found, and applies the slashed_bricks/css_bundle_url filter. The prior E_USER_NOTICE trigger for missing local files is removed.
Installation and bundle documentation
integrations/bricks/README.md
Installation instructions now document jsDelivr as the default CSS source with optional offline use via copying the dist/ folder. The "CSS Bundle" section describes the jsDelivr default and clarifies that locally detected bundles take precedence.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • codeslash-dev/SLASHED#71: Introduces the initial Bricks integration that this PR builds upon with the CDN-default improvement.
🚥 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 describes the main change: switching to jsDelivr CDN as the default CSS source for the Bricks integration, which is the primary objective reflected in both the code and documentation updates.
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-jsdelivr-default

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

🤖 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 39-40: The default CDN URL in $default_url currently pins to the
mutable `@main`; change it to point at the published/dist artifact (or pin to a
specific release tag/commit) so styles are reproducible—update the $default_url
value in slashed-bricks.php (the $default_url variable) to use the stable dist
path or a tagged/commit URL instead of '`@main`'.
🪄 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: 608f9276-ed15-45cf-ac08-a016b3f798ba

📥 Commits

Reviewing files that changed from the base of the PR and between f20370a and 6e8ff8f.

📒 Files selected for processing (2)
  • integrations/bricks/README.md
  • integrations/bricks/slashed-bricks.php

Comment on lines +39 to +40
// Default: jsDelivr CDN pointing to main branch latest.
$default_url = 'https://cdn.jsdelivr.net/gh/codeslash-dev/SLASHED@main/dist/slashed.optimal.css';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

urls=(
  "https://cdn.jsdelivr.net/gh/codeslash-dev/SLASHED@main/dist/slashed.optimal.css"
  "https://cdn.jsdelivr.net/gh/codeslash-dev/SLASHED@dist/slashed.optimal.css"
)

for u in "${urls[@]}"; do
  code="$(curl -s -o /dev/null -w "%{http_code}" "$u")"
  ctype="$(curl -sI "$u" | awk -F': ' 'tolower($1)=="content-type"{print $2}' | tr -d '\r')"
  echo "$code | $ctype | $u"
done

Repository: codeslash-dev/SLASHED

Length of output: 284


Default CDN URL should not track mutable @main.
Both @main/dist/slashed.optimal.css and @dist/slashed.optimal.css currently return 200 text/css, so this isn’t an immediate break—but defaulting to @main makes styling non-reproducible and subject to future changes. Point the default at the published dist artifact instead (or pin to a tag/commit).

Suggested fix
-    $default_url = 'https://cdn.jsdelivr.net/gh/codeslash-dev/SLASHED@main/dist/slashed.optimal.css';
+    $default_url = 'https://cdn.jsdelivr.net/gh/codeslash-dev/SLASHED@dist/slashed.optimal.css';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Default: jsDelivr CDN pointing to main branch latest.
$default_url = 'https://cdn.jsdelivr.net/gh/codeslash-dev/SLASHED@main/dist/slashed.optimal.css';
// Default: jsDelivr CDN pointing to main branch latest.
$default_url = 'https://cdn.jsdelivr.net/gh/codeslash-dev/SLASHED@dist/slashed.optimal.css';
🤖 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/slashed-bricks.php` around lines 39 - 40, The default CDN
URL in $default_url currently pins to the mutable `@main`; change it to point at
the published/dist artifact (or pin to a specific release tag/commit) so styles
are reproducible—update the $default_url value in slashed-bricks.php (the
$default_url variable) to use the stable dist path or a tagged/commit URL
instead of '`@main`'.

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