Feature #81223
closedincludeCSS.forceInline property
100%
Description
The attached patch adds a property '.forceInline' to 'page.includeCSS'.
If '.forceInline' is set, the contentd of the css-file is inlined using <style>-tags.
Under certain conditions, inlining some CSS can improve frontend performance.
It can also help making the Google PageSpeedTest happy.
(see https://developers.google.com/speed/docs/insights/OptimizeCSSDelivery)
Example:
page.includeCSS { inline = EXT:test/Resources/Public/Css/inline.css inline { forceInline = 1 forceOnTop = 1 media = all } other = EXT:test/Resources/Public/Css/other.css }
Some notes on the attached implementation:
External files are not inlined.
The inline-css is compressed if config.compressCss is set.
Most other properties (.allWrap, .disableCompression, .forceOnTop, .if, .media, .title) work even if '.forceInline' is set.
If '.import' and '.forceInline' are both set , the file is loaded via @import.
The feature could be added to 'includeCSSLibs' too (but I don't understand the purpose of 'includeCSSLibs' at all).
Documentation changes are not included.
Files