docs: Add $cdn property to CDN Assets example#393
Merged
Conversation
Co-authored-by: samdark <47294+samdark@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add code example for CDN assets in assets guide
docs: Add $cdn property to CDN Assets example
Mar 16, 2026
samdark
approved these changes
Mar 16, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Assets guide to correctly document CDN-hosted asset bundles by adding the missing $cdn = true flag and aligning the Bootstrap CDN example with SRI usage expectations.
Changes:
- Expand the “CDN Assets” section with an explanation of
$cdn = trueand update the example bundle accordingly. - Add
$cssOptions(SRIintegrity/crossorigin) for the Bootstrap CDN CSS resource. - Remove the jQuery example’s CDN-related comment and (currently) the related
$jsOptionssnippet.
Comment on lines
305
to
313
| final class JqueryAsset extends AssetBundle | ||
| { | ||
| public string $basePath = '@assets'; | ||
| public string $baseUrl = '@assetsUrl'; | ||
|
|
||
| public array $js = [ | ||
| 'js/jquery-3.6.0.min.js', | ||
| ]; | ||
|
|
||
| // Or use CDN | ||
| public array $jsOptions = [ | ||
| 'integrity' => 'sha256-...', | ||
| 'crossorigin' => 'anonymous', | ||
| ]; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The CDN Assets code example was missing the
$cdn = trueproperty, which is required to signal to the asset manager that assets are externally hosted (skipping local publishing and path resolution).Changes
public bool $cdn = true;to the example bundle, added a short prose explanation of what the property does, added$cssOptionswith SRI integrity/crossorigin to match the existing$jsOptions, and corrected the Bootstrap 5.1.3 CSS integrity hash// Or use CDNcomment that was annotating SRI attributes unrelated to CDN usageOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.