vvo / lazyload

:bullettrain_front: Lazyload images, iframes, widgets with a standalone JavaScript lazyloader
https://vvo.github.io/lazyload/
MIT License
938 stars 158 forks source link

Change minifying engine to closure compiler #68

Closed gmetais closed 9 years ago

gmetais commented 9 years ago

Closure compiler complains a little during the build.

WARNING - If this if/for/while really shouldn't have a body, use {}

This empty loop is the reason:

for (var i = this.length; i-- && this[i] !== value;) {}

But it works!

vvo commented 9 years ago

AWESOME!

kapouer commented 9 years ago

I probably won't until the day i'll package it for debian :) Corrected uglifyjs lazyload.js -c -m --mangle-props --reserve-domprops > lazyload.min.js gives a lazyload.min.js of 3819 bytes with latest version. Mangle-props is unsafe but usable if you know what you're doing.

vvo commented 9 years ago

gives a lazyload.min.js of 3819 bytes with latest version.

So is this better than closure?

kapouer commented 9 years ago

3819 - 3788 = 31 bytes... since i don't have a working web page under my fingers with lazyload.min.js that i can test, i don't know if this version works. The command-line to get this level of compression is given above.