Bug #83476

Few attributes are missing when concatenating JS files

Added by Rune Piper over 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2018-01-04
Due date:
% Done:

100%

Estimated time:
0.50 h
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

When using the config.concatenateJs = 1 option, the ResourceCompressor is loosing tag attributes such as the async attribute in the concatenateJsFiles method.
A fix would be to add 'async' => $fileOptions['async'] after line 201, but I guess, it's too dirty for the core?!

Aside: Fresh installation with just tiny template:

config {
    concatenateJs = 1
}

page = PAGE
page.10 = TEXT
page.10.value = HELLO WORLD!
page.includeJSFooter {
    combined = path/to/file.css
    combined.async = 1
}


Related issues

Related to TYPO3 Core - Bug #86982: JS async not working Closed 2018-11-23

Associated revisions

Revision 09576ce7 (diff)
Added by Rune Piper almost 2 years ago

[FEATURE] Load merged JS files asynchronous

The async attribute is now assigned to the script tag of the concatenated
JS files if all files have the async attribute enabled in TypoScript.

Resolves: #83476
Releases: master
Change-Id: If4d5f03cac5920cf0bcccefb2e91cc229f9b9e77
Reviewed-on: https://review.typo3.org/57130
Reviewed-by: Sascha Egerer <>
Tested-by: TYPO3com <>
Reviewed-by: Wouter Wolters <>
Reviewed-by: Andreas Fernandez <>
Tested-by: Andreas Fernandez <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

History

#1 Updated by Rune Piper over 2 years ago

When using the config.concatenateJs = 1 option, the ResourceCompressor is loosing tag attributes such as the async attribute in the concatenateJsFiles method.
A fix would be to add 'async' => $fileOptions['async'] after line 201, but I guess, it's too dirty for the core?! What if one file should be loaded via async and another not?

Aside: Fresh installation with just tiny template:

config {
    concatenateJs = 1
}

page = PAGE
page.10 = TEXT
page.10.value = HELLO WORLD!
page.includeJSFooter {
    combined = path/to/file.js
    combined.async = 1
}

#2 Updated by Stephan Bauer almost 2 years ago

Maybe it would be possible to take care of async or defer.

This would be very flexible if only those file are concatenated with the same options

It would be great for Google Pagespeed

#3 Updated by Gerrit Code Review almost 2 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57130

#4 Updated by Gerrit Code Review almost 2 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57130

#5 Updated by Gerrit Code Review almost 2 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57130

#6 Updated by Gerrit Code Review almost 2 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57130

#7 Updated by Gerrit Code Review almost 2 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57130

#8 Updated by Gerrit Code Review almost 2 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57130

#9 Updated by Rune Piper almost 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#10 Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed

#11 Updated by Susanne Moog 2 months ago

  • Related to Bug #86982: JS async not working added

Also available in: Atom PDF