Less easy: finding good polyfills.
There has to be a better way, right? There is.
A few months ago I wrote very briefly about Polyfill.io.
Polyfill.io is a polyfill service written by Jonathan Neal for the Financial Times, who is an amazing contributor to the open source community. To use it, you just add this to your site:
What it does #
The service automatically detects your visitor’s browser and generates a set of polyfills that patch any holes in their browser’s features. It works all the way back to IE7 for most features!
The latest version of Chrome get’s nothing. IE7 gets about 15kb of code. Most browsers get somewhere around 5kb. (These numbers are after gzipping.)
My thoughts #
When I first wrote about Polyfill.io, I had not yet used it on a project, but heard a lot of great things about it from others.
I’ve now had the chance to use it on a large project, and I’m never looking back.
Polyfill.io pushed me head first into ES6, which I had previously been hesitant to use because of the lack of native browser support. Polyfill.io just makes it all so easy. My previous bar for entry was IE9. I can now provide even broader support with less work!
This is a no-brainer for me. I’m using it on every project.
What features are supported? #
Polyfill.io has a growing list of supported features.
Features with a star next to them are included by default. They’re selected for their broad support, popularity, and performance impact. You can add additional features using flags.
I could go on and on about this project. Do yourself a favor and start using it today.
🔥 Hot off the press! I just launched a new pocket guide. Learn about ES6 arrow functions,
const, function hoisting, and more.