Last active
July 20, 2020 15:14
-
-
Save philipwalton/fcf8be306f6bd383119d8391947ac3a8 to your computer and use it in GitHub Desktop.
Measure the Core Web Vitals without a bundler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Load `web-vitals` using a module script. --> | |
<script type="module"> | |
import {getCLS, getFID, getLCP} from 'https://unpkg.com/[email protected]/dist/web-vitals.es5.min.js?module'; | |
getCLS(console.log); | |
getFID(console.log); | |
getLCP(console.log); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Load `web-vitals` using a classic script that sets the global `webVitals` object. --> | |
<script defer src="https://unpkg.com/[email protected]/dist/web-vitals.es5.umd.min.js"></script> | |
<script> | |
addEventListener('DOMContentLoaded', function() { | |
webVitals.getCLS(console.log); | |
webVitals.getFID(console.log); | |
webVitals.getLCP(console.log); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment