- Issue created by @adamps
CssOptimizer::optimize()
throws an exception if the asset is not a file assets with preprocessing enabled. JsOptimizer
is the same. This is not documented on AssetOptimizerInterface
, and it's probably not a necessary restriction.
The exception requires the calling to code to understand the internals of whether an asset can be optimised, and then avoid calling this function accordingly. These factors could change, even in a minor version.
It's not clear that this function should prevent external assets from be optimised. Although the CSS aggregation would only want to optimise file assets, other code using the service might be different. If a site wanted to send an email styled with CSS that was external and contained @import that's exactly what it would need.
Other options:
Active
11.0 🔥