Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: New component <o:criticalStylesheet> for Critical CSS #797

Closed
banifou opened this issue Apr 11, 2024 · 1 comment
Closed

Comments

@banifou
Copy link

banifou commented Apr 11, 2024

It is such a pity that there is nothing like 'criticalCSS' for JSF. It would be nice to have at least a new component like '<o:criticalStylesheet>'. When this component appears in the header, the CombinedResourceHandler should leave the CSS file inlined and remove all separate stylesheet resources, creating a combined and non-blocking one for all stylesheets.

The non-blocking stylesheet should look as follows:
<link rel="preload" href="nonBlockingCombined.css" as="style" onload="this.onload=null;this.rel='stylesheet'"> <noscript><link rel="stylesheet" href="nonBlockingCombined.css"></noscript>

It should have an option, whether the nonBlockingCombined CSS should or should not contain the primefaces stylesheets components.css and layout.css.

@banifou banifou changed the title Feature Request: New component <o:criticalStylesheet> Critical CSS Feature Request: New component <o:criticalStylesheet> for Critical CSS Apr 11, 2024
@BalusC BalusC closed this as completed in 1ea98f4 May 24, 2024
@BalusC
Copy link
Member

BalusC commented May 24, 2024

<o:criticalStylesheet> has been added to OmniFaces 4.5.
The CombinedResourceHandler transparently recognizes it.


It should have an option, whether the nonBlockingCombined CSS should or should not contain the primefaces stylesheets components.css and layout.css.

Simply explicitly redeclare them as <o:criticalStylesheet>:

<o:criticalStylesheet library="primefaces" name="components.css" />
<o:criticalStylesheet library="primefaces" name="layout.css" />

BalusC added a commit that referenced this issue May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants