Project

General

Profile

Actions

Feature #97652

open

f:asset.css and f:asset.script should be able to render CSS and JS from referenced files as block inline

Added by Jan Loderhose almost 2 years ago. Updated almost 2 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2022-05-18
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

One essential aspect of professional SEO for high availability and high-performance online solutions is a fine-grained CSS and JS devilery tailored to the respective situation and persona of every single page view. The inline integration of critical CSS and JS is an indispensable measure for the optimal coordination of payload, round trips, render time etc. Offloading this optimization to HTTP/2 only does not even come close to the optimal solution. f:asset.css and f:asset.script contribute to this scaleability to a large extend by adding assets to the source only when the corresponding component is rendered! thumbs up

But it is currently not possible to integrate files with the ViewHelpers f:asset.css and f:asset.js and have their content output inline. Since both ViewHelpers are set to replace the integration of CSS and JS with TypoScript at some point (at least that is what I've read so far), this option must be created.

I know that it is possible to place CSS and JS as content directly within the ViewHelpers enclosing tags. But that is not an option for the development and maintenance of seriously meant projects. The strength of TYPO3 is its granularity and therefore the flexibility to compose dev teams of specialist for each aspect of the project. To keep this strength the freedom to leverage modern FE development concepts is essential. To copy and paste e.g. CSS resulting from a development pipeline into to a fluid template to have it rendered inline is not a modern development concept.

I therefore suggest giving the ViewHelpers f:asset.css and f:asset.js additional attributes to allow the following:

  • Include CSS files to render them inline as individual style blocks: critical="true"
  • Include CSS files to render them inline and concatenated as a single combined style block: critical="true" concatenate="true"
  • Include JS files to render them inline as individual script block: inline="true"
  • Include JS files to render them inline and concatenated as a single combined script block: inline="true" concatenate="true"

Since these features are essential to contemporary, professional FE development they should be part of the core rather than community extensions.


Files

f_asset-css-inline-and-external-poc.html (1.37 KB) f_asset-css-inline-and-external-poc.html Refer to multiple CSS files stored locally and external. Jan Loderhose, 2022-05-20 09:10
f_asset-css-single-inline-only-poc.html (1.23 KB) f_asset-css-single-inline-only-poc.html Refer to a CSS file and have its content rendern inline in the <head> one by one. Jan Loderhose, 2022-05-20 09:10
f_asset-css-concatenated-and-single-inline-only-poc.html (1.99 KB) f_asset-css-concatenated-and-single-inline-only-poc.html Refer to multiple CSS files and have their content rendered inline in the <head> combined to a single style block. Jan Loderhose, 2022-05-20 09:10
f_asset-js-concatenated-and-single-inline-only-poc.html (681 Bytes) f_asset-js-concatenated-and-single-inline-only-poc.html Refer to multiple JS files and have their content rendered inline combined to a single script block. Jan Loderhose, 2022-05-20 09:20
f_asset-js-single-inline-poc.html (697 Bytes) f_asset-js-single-inline-poc.html Refer to multiple js files and have their content rendered inline in the <head> combined to a single script block. Jan Loderhose, 2022-05-20 09:20
f_asset-js-inplace.html (858 Bytes) f_asset-js-inplace.html Include js and have it rendered at the position it is included wihtin the fluid template. Jan Loderhose, 2022-05-20 10:02
Actions

Also available in: Atom PDF