Adds browser-native loading="lazy" attribute to images and iframes rendered by Camaleon CMS.

gem install camaleon_lazy_loader -v 0.1.2


Gem Version Ruby Style Guide Build Status


This plugin adds a loading="lazy" attribute to <img> and <iframe> tags rendered by Camaleon CMS.

  • This attribute will be added to tags on all server-rendered pages.
  • Existing loading attributes will not be overwritten, so you can still set individual tags to loading="eager" or loading="auto"

How it works

This plugin updates the body of the http response using the front_after_load hook provided by Camaleon, unless the page is cached with the Front Cache plugin.

If the Front Cache plugin is active

  • For pages that are not cached, this plugin works as described above.
  • For pages that are cached:
    • The affects of this plugin are applied to the cache entry when it is saved using the front_cache_writing_cache hook.
    • There is no processing when reading from the cache.
  • Activating/deactivating this plugin will clear the Front Cache.


Just turn on the plugin in your admin settings.


Add this line to your application's Gemfile:

gem 'camaleon_lazy_loader'

And then execute:

$ bundle


  • Fork the repo.
  • Make your changes and add tests as necessary.
  • Run standardrb to lint your code.
  • Submit a pull request.


The gem is available as open source under the terms of the MIT License.