Skip to content

refactor(assets)!: replace AssetLoaderTrait with AssetLoader class#705

Merged
aryanjasala merged 2 commits into
theme-elementary-v2from
refactor/assets-extend-assetloader
Jun 4, 2026
Merged

refactor(assets)!: replace AssetLoaderTrait with AssetLoader class#705
aryanjasala merged 2 commits into
theme-elementary-v2from
refactor/assets-extend-assetloader

Conversation

@aryanjasala

Copy link
Copy Markdown
Member

What this does

Migrates the theme's Assets class onto the framework's new concrete
AssetLoader. The asset loader is now an object the theme extends rather
than a trait it mixes in. No behaviour change — the same scripts/styles register
on the same hooks.

Changes

  • inc/Core/Assets.php: use AssetLoaderTraitextends AssetLoader;
    constructor now calls
    parent::__construct( ELEMENTARY_THEME_PATH, get_template_directory_uri(), 'assets/build' ).

Breaking change / dependency

Requires rtcamp/wp-framework with AssetLoader (the trait has been removed).
Depends on rtCamp/wp-framework#34 — merge that first, then this resolves on
dev-main.

How I verified

  • PHPStan — no errors (against the framework branch with AssetLoader).

Convert the asset-loading mixin into a concrete, injectable class so it
has an instance identity that can be passed around and shared.

Copilot AI 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.

Pull request overview

Migrates the theme’s Assets loader implementation from the framework’s former AssetLoaderTrait mixin to the new concrete rtCamp\WPFramework\AssetLoader base class, keeping the theme’s asset registration/enqueue hooks in place while aligning with the framework’s updated API.

Changes:

  • Replaces use AssetLoaderTrait with extends AssetLoader in the theme Assets class.
  • Updates the constructor to delegate base path/URL/assets directory initialization to AssetLoader::__construct(...).
  • Adds/expands class-level documentation to reflect the new inheritance-based design.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Refresh composer.lock: rtcamp/wp-framework dev-main e3d6522 → b947582,
the main tip that now carries the AssetLoader class. The full update also
advances the phpstan and wp-cli dev refs.
@pratik-londhe4 pratik-londhe4 self-requested a review June 4, 2026 12:36
@aryanjasala aryanjasala merged commit a83e275 into theme-elementary-v2 Jun 4, 2026
8 checks passed
@aryanjasala aryanjasala deleted the refactor/assets-extend-assetloader branch June 4, 2026 12:37
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.

3 participants