Issue Feature Closed

#81223includeCSS.forceInline property

Raphael Graf 05/14/17, 20:03 updated 10/02/18, 10:59

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.</p> <p>Under certain conditions, inlining some CSS can improve frontend performance. <br />It can also help making the Google PageSpeedTest happy. <br />(see <a href="https://developers.google.com/speed/docs/insights/OptimizeCSSDelivery" target="_blank" rel="noreferrer">https://developers.google.com/speed/docs/insights/OptimizeCSSDelivery</a>)</p> <p>Example:</p> <p>

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
}
</p> <p>Some notes on the attached implementation:</p> <p>External files are not inlined.<br />The inline-css is compressed if config.compressCss is set.<br />Most other properties (.allWrap, .disableCompression, .forceOnTop, .if, .media, .title) work even if &#8216;.forceInline&#8217; is set. <br />If &#8216;.import&#8217; and &#8216;.forceInline&#8217; are both set , the file is loaded via @import. <br />The feature could be added to &#8216;includeCSSLibs&#8217; too (but I don&#8217;t understand the purpose of &#8216;includeCSSLibs&#8217; at all).<br />Documentation changes are not included.</p></style>

Reviews 1