Skip to main content

Integration of lazysizes, a lightweight lazy loader, into Plone.

Project description

Life, the Universe, and Everything

This package integrates lazysizes, a lightweight lazy loader, into Plone.

lazysizes is a fast, SEO-friendly and self-initializing lazyloader for images (including responsive images picture/srcset), iframes, scripts/widgets and much more. It also prioritizes resources by differentiating between crucial in view and near view elements to make perceived performance even faster.

By using this package you can expect reductions of up to 80% in load time, 75% in page size and 50% in number of requests.

Mostly Harmless

http://img.shields.io/pypi/v/collective.lazysizes.svg https://img.shields.io/travis/collective/collective.lazysizes/master.svg https://img.shields.io/coveralls/collective/collective.lazysizes/master.svg

These are some sites using collective.lazysizes:

As long as we have tested, lazysizes seems not to interfere with image indexing made by crawlers like Googlebot.

Got an idea? Found a bug? Let us know by opening a support ticket.

Don’t Panic

Installation

To enable this package in a buildout-based installation:

  1. Edit your buildout.cfg and add add the following to it:

    [buildout]
    ...
    eggs =
        collective.lazysizes

After updating the configuration you need to run ‘’bin/buildout’’, which will take care of updating your system.

Go to the ‘Site Setup’ page in a Plone site and click on the ‘Add-ons’ link.

Check the box next to collective.lazysizes and click the ‘Activate’ button.

How does it work

This package adds a transformer to the transform chain to integrate lazysizes into Plone.

The transformer looks for all the <img>, <iframe> and <blockquote> tags inside the content and does the following:

  • appends a lazyload class

  • if the tag is an <img>, transforms the src attribute into a data-src and uses a gray square in its place to maintain valid HTML code (this placeholder is loaded using the data URI scheme to avoid a new request to the server)

  • if the tag is an <iframe>, transforms the src attribute into a data-src

  • if the tag is a <blockquote> containing a tweet, it adds a data-twitter attribute and removes the <script> tag associated with the Twitter widget to avoid a useless request

These transforms are applied to anonymous users only.

Todo

  • implement support for responsive images with srcset and automatic sizes attribute

Share and Enjoy

collective.lazysizes would not have been possible without the contribution of the following people:

You can find an updated list of package contributors on GitHub.

Development sponsored by Simples Consultoria.

Changelog

2.0.0b1 (2016-08-11)

  • lazysizes was upgraded to version 2.0.0 and we are using now the AMD module (closes #20). [rodfersou]

  • Do not raise an exception in case Twitter’s embed code was somehow modified (closes #17). [hvelarde]

1.5.0b1 (2016-05-25)

  • Embedded tweets are now also lazy loaded (closes #15). [aFarkas, rodfersou, hvelarde]

  • Package is now compatible with Plone 5.0 and Plone 5.1. [hvelarde]

1.5.0a1 (2016-04-07)

  • Use data URI scheme for image placeholder to save one additional request (closes #8). [hvelarde]

  • Brazilian Portuguese and Spanish translations were added. [hvelarde]

  • Deal better with <img> tags with no src attribute; log an error message with the request URL (closes #11). [hvelarde]

  • Package is now compatible with Plone 5. [hvelarde]

  • Remove dependency on Products.CMFQuickInstallerTool. [hvelarde]

  • Update lazysizes and respimg polyfill extension to v1.5.0. [hvelarde]

1.4.0a1 (2016-02-23)

  • Add option to list class identifiers that will not be processed for lazy loading. <img> and <iframe> elements with that class directly applied to them, or to a parent element, will be skiped (closes #5). [rodfersou, hvelarde]

  • Update lazysizes and respimg polyfill extension to v1.4.0. [hvelarde]

  • Use a blank image instead of a spinner as placeholder. [hvelarde]

  • Logging now uses debug level instead of info. [hvelarde]

1.0a1 (2016-01-05)

  • Initial release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

collective.lazysizes-2.0.0b1.tar.gz (39.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

collective.lazysizes-2.0.0b1-py2-none-any.whl (50.9 kB view details)

Uploaded Python 2

File details

Details for the file collective.lazysizes-2.0.0b1.tar.gz.

File metadata

File hashes

Hashes for collective.lazysizes-2.0.0b1.tar.gz
Algorithm Hash digest
SHA256 c26eedd699f44803bb4081943fcffa983700db03bda46e279035e6ea75c3f47a
MD5 75992f167b51b21f682c9cb4aa34b422
BLAKE2b-256 20f345b59c669b090bef76b4458c6ec7fc1617d129bec204ddc8d6dcb414b2fc

See more details on using hashes here.

File details

Details for the file collective.lazysizes-2.0.0b1-py2-none-any.whl.

File metadata

File hashes

Hashes for collective.lazysizes-2.0.0b1-py2-none-any.whl
Algorithm Hash digest
SHA256 8eece34bd0de2badd6f0f6c68bd503429cce9e07895f7ab5d60f5159ddb7630f
MD5 f9022b28711e6fa38611e74c3aab9622
BLAKE2b-256 4a984465e23fb3845806c6f502c44cef7e55b939fa1c283b7f7f9e52dec69349

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page