Exploring Cython: A Bridge Between Python and C/C++
A comprehensive guide that explores Cython, a superset of Python that can achieve C-like performance levels while maintaining Python's ease of use.
💡 Good to know: CSS is a render blocking resource. This means it'll block rendering any content until CSS is fully processed!
Given the above, for sure there will be some impact on the Core Web Vitals/Lighthouse score for your web app due to CSS. There are 2 ways to fix this:
<style>
tag)Of course, second one is straightforward but not applicable in some situations. So I'll explain below how to go with 1st option.
Preconencting is basically that you're telling the browser: I'm going to establish a connection later to this origin, but I'd like you to process and establish a connection ASAP. Usually creating a connection takes some time, with preconnect you start the process sooner resulting in faster connection to your resource on the remote origin.
<!-- connect to domain of font files --> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
Preloading means that since you've already made a preconnection to the origin, now it's time to actually load that resource. This is very useful if you know you're going to use that file later on the same page, or in a next page, so when you go to that page, the resource is immediately available.
```html ```Using print
media type unblocks rendering immediately. Because print styles are only used when you print a page. So the browser will load the resource, but will not block rendering.
Also here we add a small piece of JavaScript which tells the browser that after the CSS this
is fully loaded (which happens while doing other stuff including rendering the page), then please remove the media
attribute all together now this applies the CSS right away. Also we remove the onload
function all together (not needed anymore).
Finally if the user's browser have JavaScript disabled, this means your CSS will never put into effect, because the onload
function above will never run.
To fix this, we can use a <noscript></noscript>
element so we just put the CSS into effect right away, without any delay (and yeah, leave it render blocking as is).
<!-- connect to domain of font files --> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <!-- optionally increase loading priority --> <link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Dancing+Script&family=Merriweather&family=Open+Sans&display=swap"> <!-- async CSS --> <link rel="stylesheet" media="print" onload="this.onload=null;this.removeAttribute('media');" href="https://fonts.googleapis.com/css2?family=Dancing+Script&family=Merriweather&family=Open+Sans&display=swap"> <!-- no-JS fallback --> <noscript> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Dancing+Script&family=Merriweather&family=Open+Sans&display=swap"> </noscript>
That's it. Thanks for reading Devspedia. I'll see you the next time! 👋