Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

camaleon_lazy_loader

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

camaleon_lazy_loader

  • 1.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Gem Version Ruby Style Guide Build Status

CamaleonLazyLoader

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. Nokogiri is used to add the loading attribute.

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.

Usage

Just turn on the plugin in your admin settings.

Installation

Add this line to your application's Gemfile:

gem 'camaleon_lazy_loader'

And then execute:

$ bundle

Limitations

This gem uses Nokogiri, which in turn wraps underlying parsers. Some characters can be altered by these parsers when used in element attributes. Known cases include:

  • The AMP lightning bolt ⚡
  • Characters that are escaped in HTML, such as endash or ampersand

Contributing

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

License

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

FAQs

Package last updated on 05 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc