Assets with preprocess: false and no minified: true throwing exceptions in site logs

Created on 8 May 2025, 9 days ago

Problem/Motivation

Files defined in autoban.libraries.yml using preprocess: false generate logs due to an exception thrown if the file doesnโ€™t also have minified: true:

Exception: Only file CSS assets can be optimized. in Drupal\Core\Asset\CssOptimizer->optimize() (line 43 of /var/www/html/docroot/core/lib/Drupal/Core/Asset/CssOptimizer.php).

Exception: Only file JavaScript assets with preprocessing enabled can be optimized. in Drupal\Core\Asset\JsOptimizer->optimize() (line 34 of /var/www/html/docroot/core/lib/Drupal/Core/Asset/JsOptimizer.php).

Steps to reproduce

  1. Turn on dblog in a Drupal project with autoban installed and asset aggregation enabled.
  2. Visit the public site.
  3. Filter the logs by PHP messages and observe error messages.

Proposed resolution

As suggested in 3416508 ๐Ÿ› Only file JavaScript assets with preprocessing enabled can be optimized. Active , add minified: true to library definitions that use preprocess: false in autoban.libraries.yml.

User interface changes

None.

API changes

None.

Data model changes

None.

๐Ÿ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States agarzola

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024