Aggregate and bundle only JavaScript with defer without forcing all to defer?

Created on 3 August 2019, almost 5 years ago
Updated 20 October 2023, 8 months ago

Is there some way to aggregate/bundle JavaScript files marked with attributes: { defer: true } without having to force all JavaScript to be deferred? I've got some components that are designed to be deferred, for performance reasons, but I don't want to open the can of worms that it would be force all the Drupal JavaScript to be deferred. After a bit of digging, I found this core issue that explains that deferred scripts are excluded from aggregation πŸ› JavaScript aggregation should account for "async" and "defer" attributes Needs work , and enabling advagg_mod to force preprocessing of deferred scripts fixed the aggregation issue, but now they're all bundled together in a non-deferred bundle, which does little to solve my problem.

Related issues:
πŸ› JavaScript aggregation should account for "async" and "defer" attributes Needs work

πŸ’¬ Support request
Status

Needs work

Version

4.0

Component

Compression/Minification

Created by

πŸ‡¨πŸ‡¦Canada Ambient.Impact Toronto

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024