Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Introduce additional attributes for all page.include** TS c…
…onfigurations Introduce tag attributes for the following TypoScript configurations: * page.includeCSS * page.includeCSSLibs * page.includeJS * page.includeJSFooter * page.includeJSLibs * page.includeJSFooterlibs The syntax can then be * page.includeCSS.my-attribute = my-value Resolves: #91499 Releases: main Change-Id: Icadaa53d379eb5417ea995dff7b5a2b8ade4ec9b Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65008 Tested-by: Georg Ringer <georg.ringer@gmail.com> Tested-by: core-ci <typo3@b13.com> Tested-by: Simon Schaufelberger <simonschaufi+typo3@gmail.com> Tested-by: Benni Mack <benni@typo3.org> Reviewed-by: Georg Ringer <georg.ringer@gmail.com> Reviewed-by: Simon Schaufelberger <simonschaufi+typo3@gmail.com> Reviewed-by: Benni Mack <benni@typo3.org>
- Loading branch information
Showing
4 changed files
with
335 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
.../Feature-91499-AdditionalAttributesForIncludeJSIncludeCSSAndAllOtherInclude.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
.. include:: /Includes.rst.txt | ||
|
||
============================================================================================== | ||
Feature: #91499 - Additional attributes for includeJS, includeCSS and all other page.include** | ||
============================================================================================== | ||
|
||
See :issue:`91499` | ||
|
||
Description | ||
=========== | ||
|
||
PageRenderer supports additional tag attributes for CSS and JavaScript files. | ||
These data attributes can be configured using a key-value list via TypoScript. | ||
|
||
* :ts:`page.includeCSS` | ||
* :ts:`page.includeCSSLibs` | ||
* :ts:`page.includeJS` | ||
* :ts:`page.includeJSFooter` | ||
* :ts:`page.includeJSLibs` | ||
* :ts:`page.includeJSFooterlibs` | ||
|
||
|
||
Impact | ||
====== | ||
|
||
It is now possible to extend script and link tags with any kind of | ||
HTML tag attributes, which is very useful for integration with | ||
external scripts such as Consent manager. | ||
|
||
Example | ||
^^^^^^^ | ||
|
||
Configuration: | ||
|
||
.. code-block:: ts | ||
page = PAGE | ||
page { | ||
includeCSSLibs { | ||
someIncludeFile = fileadmin/someIncludeFile1 | ||
someIncludeFile.data-foo = includeCSSLibs | ||
} | ||
includeCSS { | ||
someIncludeFile = fileadmin/someIncludeFile2 | ||
someIncludeFile.data-foo = includeCSS | ||
} | ||
includeJSLibs { | ||
someIncludeFile = fileadmin/someIncludeFile3 | ||
someIncludeFile.data-consent-type = marketing | ||
} | ||
includeJS { | ||
someIncludeFile = fileadmin/someIncludeFile4 | ||
someIncludeFile.data-consent-type = essential | ||
} | ||
includeJSFooterlibs { | ||
someIncludeFile = fileadmin/someIncludeFile5 | ||
someIncludeFile.data-my-attribute = foo | ||
} | ||
includeJSFooter { | ||
someIncludeFile = fileadmin/someIncludeFile6 | ||
someIncludeFile.data-foo = includeJSFooter | ||
} | ||
} | ||
Reserved keywords which will not be mapped to attributes are: | ||
- compress | ||
- forceOnTop | ||
- allWrap | ||
- type (set automatically, depending on config.doctype) | ||
- disableCompression | ||
- excludeFromConcatenation | ||
- external | ||
- inline | ||
|
||
Resulting HTML: | ||
|
||
.. code-block:: html | ||
|
||
<head> | ||
<link rel="stylesheet" type="text/css" href="/typo3conf/ext/myext/Resources/Public/someIncludeFile1" media="all" data-foo="includeCSS"> | ||
<link rel="stylesheet" type="text/css" href="/typo3conf/ext/myext/Resources/Public/someIncludeFile2" media="all" data-foo="includeCSSLibs"> | ||
|
||
<script src="/typo3conf/ext/myext/Resources/Public/someIncludeFile3" data-consent-type="marketing"></script> | ||
<script src="/typo3conf/ext/myext/Resources/Public/someIncludeFile4" data-consent-type="essential"></script> | ||
</head> | ||
<body> | ||
<script src="/typo3conf/ext/myext/Resources/Public/someIncludeFile5" data-my-attribute="foo"></script> | ||
<script src="/typo3conf/ext/myext/Resources/Public/someIncludeFile6" data-foo="includeJSFooteribs"></script> | ||
</body> | ||
|
||
.. index:: Frontend, TypoScript, ext:frontend |
Oops, something went wrong.