yotpo-minimal

0.0.30 • Public • Published

Yotpo Minimal

Yotpo's "widget.js", manually minified from 554kb+ to under 150kb (40kb across a brotli-enabled server)

Installation

<script type="application/javascript">
var requestIdleCallback = window.requestIdleCallback ||
    function(cb) {
        const start = Date.now();
        return setTimeout(function() {
            cb({
                didTimeout: false,
                timeRemaining: function() {
                    return Math.max(0, 50 - (Date.now() - start));
                },
            });
        }, 1);
    };

requestIdleCallback(function e() {
    var e = document.createElement('script');
    e.type = 'text/javascript', e.defer = !0, e.src = 'https://cdn.jsdelivr.net/npm/yotpo-minimal@latest/yotpo-minimal.js';
    var t = document.getElementsByTagName('script')[0];
    t.parentNode.insertBefore(e, t)
}, {
    timeout: 2500
});
</script>

Usage

Include above <script> tag.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Package Sidebar

Install

npm i yotpo-minimal

Weekly Downloads

3

Version

0.0.30

License

MIT

Unpacked Size

1.36 MB

Total Files

7

Last publish

Collaborators

  • brandon-pr