I searched online for tools to extract the critical css of a website for one of my clients, I couldn't find one that did the job so I did so after using Puppeteer locally and then decided to share the solution I used that let's you specify how long to wait after page load to extract the styles; even found a paid one but requested refund after it didn't work. Feedback welcome, it's free for now.
Is it the UI for penthouse lib? Settings look very similar :)
Critical CSS
111–120 of 124 posts
Re: Critical CSS
#112This is a footgun. You'll get a very consistent flash of unstyled content. It's not just an aesthetics issue -- when layout shifts in the middle of a page load, as your "non-critical" styles are applied, and user is interacting with something, it will kill your usability.
Re: Critical CSS
#113Earlier quoted context omitted.
Is the code somewhere? This seems like it'd be really useful as a Vite/Astro plugin
yeah, doing this manual copy-paste process every time you change something would count as cruel and unusual punishment
Re: Critical CSS
#114I guess this just assumes that this is the first view of your page and no user has css resources cached? Or maybe they are saying this would always be worth it? I assume it'd be a trade off between a number of factors. How many returning vs new visitors? Is css served with proper cache-control headers, 103 early hints and in a cdn? How big is your critical css, and how much of your critical html does it push out of t…
Re: Critical CSS
#115Neat idea. I tried it on my site ( https://anderegg.ca/ ) which already inlines its CSS, and got an error from the underlying library ( https://www.npmjs.com/package/penthouse ): {"error":true,"name":"Error","message":"css should not be empty","stack":"Error: css should not be empty\n at module.exports (/usr/src/app/node_modules/penthouse/lib/index.js:206:14)\n at file:///usr/src/app/server.js:153:31\n at process.pro…
Re: Critical CSS
#116Not a fan. I'm waiting for the day developers realize the fallacy of sticking with pixels as their measurement for Things on the Internet. With a deeper understanding of CSS, one would recognize that simply parsing it out for only the components "above the fold" (which, why are pixels being used here in such an assumptive manner?), completely misses what is being used in modern CSS today - global variables, content-c…
Re: Critical CSS
#117Kind of funny that the agency that made this has a loader on their site.
Re: Critical CSS
#118Earlier quoted context omitted.
It would only be ironic if they released a tool to get rid of loading on a page. > Critical CSS refers to the minimal set of CSS rules required to render the visible portion of a webpage (above the fold). In reality the tool is aimed to style most of the page without loading additional assets so you don't get a jarring repaint when visiting the site.
I prepared a comment about how the whole thing should be well under 5KB uncompressed, plus four small images and a background video that I couldn’t quite figure out, and about how the loader made no sense and made things worse . But then I checked in Chromium before stopping, and discovered that apparently the website is just completely broken in Firefox for some reason, so that you only get to see the above-the-fold…
I don't mess with the scroll, well, I do disable it before the video is loaded but I'd still love to hear your comments, would be really useful
Re: Critical CSS
#119Is there any limit etc. It gives an error on my first try. {"error":true,"name":"Error","message":"css should not be empty","stack":"Error: css should not be empty\n at module.exports (/usr/src/app/node_modules/penthouse/lib/index.js:206:14)\n at file:///usr/src/app/server.js:153:31\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"}
Re: Critical CSS
#120Assuming you are using an atomic CSS based framework like tailwind, this would be unnecessary right ? Since all the CSS class names are anyways in-lined with the element.