Skip to content

553 minify#436

Merged
tijsverkoyen merged 6 commits intomasterfrom
553-minify
Mar 25, 2026
Merged

553 minify#436
tijsverkoyen merged 6 commits intomasterfrom
553-minify

Conversation

@tijsverkoyen
Copy link
Copy Markdown
Member

@tijsverkoyen tijsverkoyen commented Mar 24, 2026

https://next-app.activecollab.com/108877/my-work?modal=Task-243491-62

Type

  • Enhancement

Resolves the following issues

No more dependencies on matthiasmullie/minify

Summary by Sourcery

Remove asset minification support and dependency from headers and shared core, and wire missing database arguments into form-related command handlers.

Enhancements:

  • Stop using the Minifier service in frontend and backend headers by instantiating plain asset collections without minification.
  • Simplify AssetCollection by removing its dependency on Minifier and treating added assets as-is.
  • Inject the database service into form and location widget copy command handlers via service configuration.

Build:

  • Drop the matthiasmullie/minify Composer dependency and associated cache directory placeholders.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Mar 24, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Removes the matthiasmullie/minify dependency by dropping runtime asset minification, simplifying AssetCollection, updating header initialisation, wiring missing command handler dependencies, and cleaning up related cache artifacts.

Class diagram for updated header asset handling without Minifier

classDiagram
    class Asset {
    }

    class Minifier {
        <<removed>>
        +css(sitePath string, publicCacheUrl string, cachePath string) Minifier
        +js(sitePath string, publicCacheUrl string, cachePath string) Minifier
        +minify(asset Asset) Asset
    }

    class AssetCollection {
        -assets array~Asset~
        +add(asset Asset, minify bool) void
        +getAssets() array~Asset~
    }

    class BackendCoreEngineHeader {
        -cssFiles AssetCollection
        -jsFiles AssetCollection
    }

    class FrontendCoreHeaderHeader {
        -cssFiles AssetCollection
        -jsFiles AssetCollection
    }

    AssetCollection "1" o-- "*" Asset

    BackendCoreEngineHeader --> AssetCollection : uses
    FrontendCoreHeaderHeader --> AssetCollection : uses

    AssetCollection .. Minifier : dependency_removed
Loading

File-Level Changes

Change Details Files
Remove runtime CSS/JS minification and dependency on the Minifier service.
  • Drop Minifier usage from backend Header and initialize CSS/JS collections without minification configuration.
  • Drop Minifier usage from frontend Header and initialize CSS/JS collections without minification configuration.
  • Simplify AssetCollection by removing its Minifier dependency and minification step in add().
  • Update AssetCollection unit test to construct the collection without a Minifier instance.
src/Backend/Core/Engine/Header.php
src/Frontend/Core/Header/Header.php
src/Common/Core/Header/AssetCollection.php
src/Common/Tests/Core/Header/AssetCollectionTest.php
Wire database dependencies for command handlers that were missing explicit configuration.
  • Add $database service argument for CopyFormWidgetsToOtherLocaleHandler.
  • Add $database service argument for CopyLocationWidgetsToOtherLocaleHandler.
src/Backend/Modules/FormBuilder/Resources/config/commands.yml
src/Backend/Modules/Location/Resources/config/commands.yml
Remove the matthiasmullie/minify package and associated cache directories.
  • Drop matthiasmullie/minify from composer.json dependencies.
  • Remove Minifier implementation class.
  • Remove minified asset cache directory placeholders for backend and frontend CSS/JS.
composer.json
src/Common/Core/Header/Minifier.php
src/Backend/Cache/MinifiedCss/.gitignore
src/Backend/Cache/MinifiedJs/.gitignore
src/Frontend/Cache/MinifiedCss/.gitignore
src/Frontend/Cache/MinifiedJs/.gitignore

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • In AssetCollection::add the $minify parameter is now unused; consider removing it (or formally deprecating it) to avoid confusion and keep the API surface aligned with the current behavior.
  • With the removal of the Minifier class and related cache directories, check whether any configuration or deployment scripts still reference the old MinifiedCss/MinifiedJs paths and clean those up to prevent stale configuration.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `AssetCollection::add` the `$minify` parameter is now unused; consider removing it (or formally deprecating it) to avoid confusion and keep the API surface aligned with the current behavior.
- With the removal of the `Minifier` class and related cache directories, check whether any configuration or deployment scripts still reference the old `MinifiedCss`/`MinifiedJs` paths and clean those up to prevent stale configuration.

## Individual Comments

### Comment 1
<location path="src/Common/Core/Header/AssetCollection.php" line_range="12-15" />
<code_context>
-    {
-    }
-
     public function add(Asset $asset, bool $minify = true): void
     {
-        if ($minify) {
-            $asset = $this->minifier->minify($asset);
-        }
-
         // we already have it we don't need to add it again
         if (array_key_exists($asset->getFile(), $this->assets)) {
             return;
</code_context>
<issue_to_address>
**suggestion:** The `$minify` parameter is now unused and could become misleading.

With the minifier dependency and logic removed, `$minify` no longer affects behavior. Keeping it suggests minification still occurs. Consider removing it if backward compatibility allows, or marking it as deprecated and explicitly ignored with a plan to remove it in the next major version.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@tijsverkoyen
Copy link
Copy Markdown
Member Author

  • In AssetCollection::add the $minify parameter is now unused; consider removing it (or formally deprecating it) to avoid confusion and keep the API surface aligned with the current behavior.

Fixed in 1b10191

  • With the removal of the Minifier class and related cache directories, check whether any configuration or deployment scripts still reference the old MinifiedCss/MinifiedJs paths and clean those up to prevent stale configuration.

Fixed in c409a22

@tijsverkoyen tijsverkoyen merged commit 70d2529 into master Mar 25, 2026
10 of 12 checks passed
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