azproduction / grunt-autopolyfiller

Grunt plugin for autopolyfiller
25 stars 1 forks source link

File per Polyfill? #2

Open jpdevries opened 10 years ago

jpdevries commented 10 years ago

I may be misundertanding the proper usage but would it make sense to have an option to output each polyfil as it's own file so they could be loaded individually? I tend to use Modernizr.load along with feature detection to only reach out for polyfills if they are needed

azproduction commented 10 years ago

Autopolyfiller is designed to avoid Modernizr, shims and shivs. You can write cutting-edge JavaScript without thinking about ES shims and shivs. Autopolyfiller will add all required ECMAScript polyfills for set of browsers that you defined.

Loading polyfills Individually may bring an startup latency overhead. Imo, it is better to concatenate all polyfills with main code or have different loading strategy like creating 2 builds to minimize unused code overhead: for every browser (with all polyfills) and for modern (with minimum set of polyfills).

If you want to get just polyfills code, it is better to download them directly: https://github.com/jonathantneal/polyfill/tree/master/source