Problem/Motivation

HTML5 proposes/solidifies asynchronous loading of JavaScript files based on two attributes: defer and async. Drupal has supported defer since at least D6, and support for async is currently in the works (#1140356: Add async, onload property to script tags).

Current behavior (as of 8.6) is that scripts with the defer attribute do not ever get aggregated (even in the case where there are multiple scripts added through one library).

Proposed resolution

We should have a list of attributes that support aggregation.
JS files with these attributes should be aggregated together if they have the same attribute values and we should make sure the attributes are on the bundle.
This means that if a library defines 3 JS files with the defer attribute, we should create a single bundle with the defer attribute.

Remaining tasks

User interface changes

None

API changes

A new aggregated_js_attributes setting allows expanding the list of attributes that are aggregated separately:

// Default value.
$settings['aggregated_js_attributes'] = ['async', 'defer'];

// Example of adding a new attribute.
$settings['aggregated_js_attributes'] = ['async', 'defer', 'data-custom-attribute'];

Data model changes

Release notes snippet

Issue fork drupal-1587536

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

iamEAP’s picture

Status: Active » Needs review
StatusFileSize
new1.99 KB

Wrong patch. Disregard.

iamEAP’s picture

StatusFileSize
new2.82 KB

Here's the right one.

This is totally untested. Just posting to get the conversation rolling.

ericduran’s picture

Status: Needs review » Needs work
+++ b/core/includes/common.incundefined
@@ -4353,31 +4351,39 @@ function drupal_group_js($javascript) {
+          $index = md5(serialize($group_keys));

Why change this to md5? Lets keep this simple and just add the new item to the group_keys.

ericduran’s picture

Issue summary: View changes

Fixing history related to defer attribute.

iamEAP’s picture

In the existing code, if you came across a JS file that had async, the logic would say, "This set of group keys is different than the last one. We need a new bundle," and would proceed to create a new bundle. Then, if the next file didn't need async, but otherwise had all of the same group keys, it'd say, "This set of group keys is different than the last one, so we need a new bundle." Which would result in three separate bundles when only two were needed. We don't want this.

The md5 wrapped around the serialize (which is a technique I'm borrowing from Views, where they use it to generate Views Cache IDs based on a series of keys), just attempts to minimize the number of aggregates.

iamEAP’s picture

Also, I guess I didn't realize drupal_group_js was an API addition to Drupal 8. Utilizing it here might make a backport very murky.

catch’s picture

Priority: Normal » Major

Marking this major now that #1140356: Add async, onload property to script tags is in.

ericduran’s picture

@iamEAP drupal_group_js is an addition in D8 but there is currently a D7 backport that is RTBC which is holding up a couple of other drupal js related patch. The issue is #865536: drupal_add_js() is missing the 'browsers' option. Once that gets in all these changes become a lot easier to backport :)

iamEAP’s picture

Status: Needs work » Needs review
StatusFileSize
new3.43 KB

Forgot the browsers property for bundling.

Setting this back to needs review for more/wider discussion.

arnested’s picture

StatusFileSize
new3.97 KB

I tried the patch in #8 and it seems to group the async scripts in its own group (I have not made a thorough review though).

But what the patch did not do was to actually put the async attribute on the script tag of the aggregated script.

Attached patch adds the attributes (also for the defer attribute) on the aggregated script tags, but is otherwise the same patch as the one in #8.

iamEAP’s picture

Nevermind. Disregard.

yurtboy’s picture

Applied cleanly

Checking patch core/includes/common.inc...
Hunk #1 succeeded at 4180 (offset -45 lines).
Hunk #2 succeeded at 4256 (offset -45 lines).
Hunk #3 succeeded at 4273 (offset -45 lines).
Applied patch core/includes/common.inc cleanly.
yurtboy’s picture

Applied cleanly

Checking patch core/includes/common.inc...
Hunk #1 succeeded at 4180 (offset -45 lines).
Hunk #2 succeeded at 4256 (offset -45 lines).
Hunk #3 succeeded at 4273 (offset -45 lines).
Applied patch core/includes/common.inc cleanly.
ericduran’s picture

Do we have test that test the different aggregation with the new properties?

xjm’s picture

Issue summary: View changes

Updated issue summary.

tim.plunkett’s picture

Category: bug » task
Priority: Major » Normal

I read the issue summary several times, and I don't see how this is a bug. If it is, can the summary clarify what is broken?

iamEAP’s picture

Suppose you add a JS file like so:

drupal_add_js('/path/to/my/file.js', array('defer' => TRUE));

When JS aggregation is disabled, this shows up just fine with the defer attribute set properly. However, once you turn aggregation on, the script you added will almost definitely be bundled into an aggregate without the defer property set. As a result, code you were expecting to fire asynchronously now fires in line. The same is true for the async property.

In other words, your async/defer scripts don't behave as expected if you have JS aggregation enabled.

iamEAP’s picture

Issue summary: View changes

Updated issue summary.

iamEAP’s picture

Category: task » bug

Updated the summary with the above details.

tim.plunkett’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests, +Needs issue summary update

Okay, that sounds reasonable. Can you copy that into the issue summary?

As @ericduran points out, this should have automated tests.

tim.plunkett’s picture

Issue summary: View changes

Updating summary to describe the bug.

cweagans’s picture

cweagans’s picture

Issue summary: View changes

Further clarification of the problem/motivation/bug.

nod_’s picture

Issue summary: View changes
Issue tags: +Novice, +JavaScript

From what I see it's fixed, anyone can confirm?

mikeytown2’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 9: d8-js_bundling_async_defer-1587536-9.patch, failed testing.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

ivan berezhnov’s picture

Issue tags: +CSKyiv18

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

andypost’s picture

Version: 8.5.x-dev » 8.6.x-dev

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mherchel’s picture

Playing around with this in 8.6. The behavior I'm seeing is that if I set the defer attribute, the JS file will never be aggregated. It will retain the defer attribute.

Even if I have multiple JS files in one library with the same weight and defer attribute, the files will not be aggregated together.

mherchel’s picture

Issue summary: View changes

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

vacho’s picture

At this time JS is pluggable, It is solved in this issue #352951 JS & CSS Preprocessing Pluggable so the method drupal_pre_render_scripts not exist and the patch is outside of context.

vacho’s picture

I found int this file /core/lib/Drupal/Core/Asset/JsCollectionGrouper.php:21

public function group(array $js_assets) {
    $groups = [];
    // ...
    $current_group_keys = NULL;
    $index = -1;
    foreach ($js_assets as $item) {
      // ...
      ksort($item['browsers']);

      switch ($item['type']) {
        case 'file':
          // ...
          // Set here: 'type', 'group', 'every_page', 'browsers', 'async', 'defer'
          $group_keys = $item['preprocess'] ? [$item['type'], $item['group'], $item['browsers']] : FALSE;
          break;

        case 'external':
          // Do not group external items.
          $group_keys = FALSE;
          break;
      }
     ...
    return $groups;
  }

I am not sure about where set 'async' and 'defer' attributes.

drup16’s picture

Playing around with this in 8.6. The behavior I'm seeing is that if I set the defer attribute, the JS file will never be aggregated. It will retain the defer attribute.

Even if I have multiple JS files in one library with the same weight and defer attribute, the files will not be aggregated together.

This seems to apply if you are not using a module like advagg enabled. The module has a feature Enable preprocess on all JS, which will do the following: Force all JavaScript to have the preprocess attribute be set to TRUE. All JavaScript files will be aggregated if enabled.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

grathbone’s picture

Status: Needs work » Needs review
Issue tags: -JavaScript +JavaScript
StatusFileSize
new4.61 KB

I've done a basically 1-for-1 re-roll of the changes onto the new files.

Status: Needs review » Needs work

The last submitted patch, 38: 1587536-38.patch, failed testing. View results

dhirendra.mishra’s picture

Assigned: Unassigned » dhirendra.mishra
dhirendra.mishra’s picture

Assigned: dhirendra.mishra » Unassigned

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

narendra.rajwar27’s picture

Assigned: Unassigned » narendra.rajwar27
narendra.rajwar27’s picture

Status: Needs work » Needs review
StatusFileSize
new1022 bytes
new5.75 KB

fix added for test case failure. Patch Applied in drupal 9.x branch.

narendra.rajwar27’s picture

Assigned: narendra.rajwar27 » Unassigned
guptahemant’s picture

Issue tags: +DIACWSep2020
guptahemant’s picture

Assigned: Unassigned » guptahemant
guptahemant’s picture

Status: Needs review » Needs work

Marking this issue as needs work since defer and async attributes are not present on the aggregated JS file.

guptahemant’s picture

Assigned: guptahemant » Unassigned
Status: Needs work » Needs review
StatusFileSize
new2.09 KB

Below is a fresh approach to resolve this issue.

First I did some research to understand how the aggregation process starts and i found that there is a method named Drupal\Core\Asset\AssetResolver::getJsAssets() which is responsible for triggering the aggregation, and there itself a condition has been added to make sure that Js libraries with assets will not be aggregated. This was added as part of https://www.drupal.org/project/drupal/issues/1664602#comment-6683702.

To resolve this issue:

  • I modified Drupal\Core\Asset\AssetResolver::getJsAssets() so that it can allow aggregation for JS libraries having attributes
  • I modified Drupal\Core\Asset\JsCollectionGrouper::group() function so that it can create aggregation groups for defer and async attributes as well.

This is an initial patch which is working good for normal page loads and will need more testing with Ajax behaviours. Also this patch tries to maintain the order of weight in which javascript files have been added as per the previous core implementation.

Please review.

Status: Needs review » Needs work

The last submitted patch, 49: 1587536-49.patch, failed testing. View results

jamesashok’s picture

Patch to include all JS attributes to be considered while aggregating, grouping for D8.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

thalles’s picture

+++ b/core/lib/Drupal/Core/Asset/AssetResolver.php
@@ -260,7 +260,7 @@ public function getJsAssets(AttachedAssetsInterface $assets, $optimize) {
+            $options['preprocess'] = $options['cache'] ? $options['preprocess'] : FALSE;

This line is broken the tests

thalles’s picture

Status    Group      Filename          Line Function                            
--------------------------------------------------------------------------------
Exception Other      phpunit-22.xml       0 Drupal\KernelTests\Core\Asset\Attac
    PHPUnit Test failed to complete; Error: PHPUnit 8.5.8 by Sebastian Bergmann
    and contributors.
    
    Testing Drupal\KernelTests\Core\Asset\AttachedAssetsTest
    ......E.............                                              20 / 20
    (100%)
    
    Time: 26.31 seconds, Memory: 8.00 MB
    
    There was 1 error:
    
    1)
    Drupal\KernelTests\Core\Asset\AttachedAssetsTest::testAggregatedAttributes
    file_get_contents(core/modules/system/tests/modules/common_test/deferred-internal.js):
    failed to open stream: No such file or directory
    
    /app/core/lib/Drupal/Core/Asset/JsOptimizer.php:25
    /app/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php:126
    /app/core/lib/Drupal/Core/Asset/AssetResolver.php:298
    /app/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php:157
    /app/vendor/phpunit/phpunit/src/Framework/TestResult.php:691
    
    ERRORS!
    Tests: 20, Assertions: 57, Errors: 1.
Fail      run-tests. Unknown              0 Unknown                            
    FATAL Drupal\KernelTests\Core\Asset\AttachedAssetsTest: test runner
    returned a non-zero error code (2).

ayushmishra206’s picture

Status: Needs work » Needs review
StatusFileSize
new766 bytes
new975 bytes

Reverted the line causing test failure.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new144 bytes

The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

rishabh vishwakarma’s picture

Status: Needs work » Needs review
StatusFileSize
new954 bytes
new1.42 KB

Adding patch against 10.1.x-dev

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.

This was previously tagged for tests and issue summary updates which still need to happen it seems.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

bnjmnm’s picture

ambient.impact’s picture

StatusFileSize
new2.09 KB

Here's a quick reroll of #55 against 10.1.x-dev that seems to work for me. #61 did not work for me on 10.1.x, so it might be out of date or missing the `AssetResolver` part of this.

ambient.impact’s picture

Whoops, looks like the patch doesn't quite work. Hiding for now until I can figure out why.

ambient.impact’s picture

Version: 11.x-dev » 10.1.x-dev

Setting to 10.1.x-dev to create the issue fork against that.

ambient.impact’s picture

Title: JS aggregation should account for "defer" and "async" attributes » JS aggregation should account for "async" and "defer" attributes

Re-ordered the attributes in the issue title to alphabetical because it was bothering me.

smustgrave’s picture

Just fyi though the issue would have to go into 11.x first before 10.x

ambient.impact’s picture

Version: 10.1.x-dev » 11.x-dev

@smustgrave My bad. Switching back.

smustgrave’s picture

No worries! If anyone here didn’t know but 11.x is the “main” branch. Where Drupal10 tags will be made off of. So no longer need to worry about 10.2.x, 10.3.x etc.

ambient.impact’s picture

StatusFileSize
new2.31 KB

Here's a patch from the current draft merge request if anyone wants a snapshot. Feel free to build on this in the merge request - a test to verify that async and defer attributes are being aggregated (while other attributes aren't) seems like the next step.

ambient.impact’s picture

@smustgrave I noticed that message on issues but didn't realize that using 11.x for 10.x.x versions was was the plan. Thanks for the heads up.

catch’s picture

Title: JS aggregation should account for "async" and "defer" attributes » Asset aggregation should account for "async" and "defer" attributes

I think we should support defer for both CSS and Javascript, so re-titling.

#2695871: Aggregation creates two extra aggregates when it encounters {media: screen} in a library declaration added some unit test coverage which I think could be used as the basis for coverage here.

catch’s picture

Also it would be good to actually use the API if we can - Umami has some footer-specific CSS files which look like good candidates. Could we apply it to all dialog CSS (like Claro's) or is it actually possible for dialogs to be part of initial paint? Any others?

catch’s picture

Title: Asset aggregation should account for "async" and "defer" attributes » JavaScript aggregation should account for "async" and "defer" attributes

No wait, deferring CSS isn't part of the spec, you can only use it on script tags :(. There are techniques for it (like https://web.dev/defer-non-critical-css/) but that's not helpful here. Back as it was then, but still the test coverage can probably be cribbed from.

agoradesign’s picture

@catch you were quicker.. just wanted to write something similar :)

ambient.impact’s picture

Ha, yeah, I was about to comment that I didn't know you could defer CSS with defer attribute. 😂

niklan’s picture

Faced same problem after upgrade on Drupal 10.1.

This

async foo() {}

Become this:

foo(){}

but

foo: async () => {}

works as expected

foo:async()=>{}

P.s. oops, looks like you are here fixing attributes problem, mine with async inside code. For those who find this issue but the problem in 'async' inside code, I've created a separate issue #3374660: Update mck89/peast composer dependency to 1.15.2

prudloff’s picture

It is also possible to use a fetchpriority attribute on CSS and JS. IMHO, assets with the same priority should be grouped together.

ambient.impact’s picture

Looks like my changes in the issue fork have some grouping problems with Drupal 10.1+'s aggregation system in that it seems to result in aggregates sometimes being generated without a file included on one page and then again with all the same contents plus the additional file. This has been biting us in #3414538: Turbo: Implement additive JavaScript aggregation to prevent multiple evaluation where we're trying to get Hotwire Turbo working with JS aggregation on but it's downloading and evaluating (nearly) the same JavaScript, and after a bunch of debugging, I finally realized it was due to us using the defer attribute plus this issue fork, because removing the attribute and removing the patch instantly fixed the JS aggregates. Edit: actually, this doesn't seem to be the case, but that I'm dumb and misunderstood a fundamental part of how aggregates are built and from what libraries; see #3411010: Document that aggregation of JavaScript files can cause redeclaration.


Given that there are also other attributes that we may want to group by (e.g. fetchpriority as mentioned by #81) and that new attributes may come along later, I propose reworking this as a more generic approach: instead of hard-coding the attributes (i.e. async, defer, etc.), we add a settings.php setting which is an array of attribute names that can be grouped, with the default being ['async', 'defer'] - this will make it easy for sites to opt into aggregating with other attributes based on their needs and be more future proof.

jv24’s picture

StatusFileSize
new2.21 KB

I'm uncertain if this is an active issue still for some. In my case for D10.3, it is. So I've updated for the patch from #73 to match with the latest changes I'm seeing in core.

prudloff’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs tests, -Needs issue summary update

I added a test.
But it seems I can't remove the draft status from the MR.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs change record, +Needs issue summary update

Left a few small comments on the MR

But will need a CR for the settings change. and probably should include in API section too.

prudloff changed the visibility of the branch 1587536-js-aggregation-async-defer-attributes-10.1.x to hidden.

prudloff’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs change record, -Needs issue summary update

I rebased the MR and added a change record: https://www.drupal.org/node/3526457

catch’s picture

Sites can do that in a site-specific services.yml so it shouldn't prevent that.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Ran test-only feature https://git.drupalcode.org/issue/drupal-1587536/-/jobs/5897064 which shows the coverage.

Believe the rest of the feedback here has been addressed too.

catch’s picture

Status: Reviewed & tested by the community » Needs review

There's still an open discussion here about moving to a service parameter instead of using $settings.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new90 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

anybody made their first commit to this issue’s fork.

anybody’s picture

@catch in #90 you wrote

There's still an open discussion here about moving to a service parameter instead of using $settings.

and set this back to NW from RTBC. Has this discussion come to a conclusion?

Just ran into this with defer, I'll try finishing this with @grevil then!

catch’s picture

Status: Needs work » Needs review

@anybody no I mean there was an open discussion in this issue, which should have been resolved before the issue was RTBC, since I marked it needs work, that discussion hasn't moved on unfortunately. Maybe 'needs review' would be better though.

catch’s picture

Status: Needs review » Needs work

Also I'm not really sure the settings/container parameter is even necessary looking at this again.

What we could do instead is allow preprocess with those two attributes (hard coded), but add the attributes to the $group_keys in JsCollectionGrouper. Then if multiple async or defer files appear next to each other, they'd end up in the same aggregate, if they don't, they won't - but they'd still get minification etc.

Moving back to needs work for that.