simplajs / simpla

Open, modular, and serverless content management for a modern web
https://www.simplajs.org
MIT License
527 stars 36 forks source link

Make multiple build targets e.g. w/o Polyfills #37

Closed bedeoverend closed 7 years ago

bedeoverend commented 8 years ago

Simpla shouldn't come with browser polyfills bundled. Right now, it will automatically check and only bring in the polyfills if needed, but users may want to use a different polyfill, or may be importing their own polyfills that may just not have loaded in time. This is weighed up against the speed of install - having a one line script import will be incredibly useful for a lot of users. The best solution is therefore having multiple build targets that users can boot Simpla with, one including polyfills, the other not.

bedeoverend commented 7 years ago

Should investigate usage of https://polyfill.io/v2/docs/ to reduce in bundled size

madeleineostoja commented 7 years ago

How is that different to modernizr and co?

bedeoverend commented 7 years ago

AFAIK Modernizr just allows you to check if the document supports things either via appending classes, or using the JS interface.

A request to polyfill.io will return the actual polyfills based on your query. Plus by default it'll also only return those polyfills if it detects the requesting browser requires them. Does the detection via the UA in the request.

For example, using <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch"></script> and the user opens the page in Chrome, that will return an empty script, because polyfill.io knows Chrome already has that feature. But if the user is on Safari, the script will have the fetch polyfill in it.

madeleineostoja commented 7 years ago

This was decided against in #62 because once Simpla supports v1 Web Components specs/polyfills, promises (which are the only sizeable polyfill we rely on) will be handled by default for element users, and SDK users can always BYO promises.