camaleon_lazy_loader 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99d95927998d9190267e103d225c2bd99afcf333d0b38735bf2367b69eabc3f1
4
- data.tar.gz: 6df42f838d97c1c86b88800ad1730b24bf426982be90a68ec867ec1d66fd2d92
3
+ metadata.gz: 3ebe3fe992635e9876617be4a1939a968e1ae67a1b19500d1c0a48674c950277
4
+ data.tar.gz: 3fe8bff63ae868bbd6a85851ae52d3e76b359e9a3310b190ec332dc994548b9a
5
5
  SHA512:
6
- metadata.gz: d45e431f0c1c0a6d01393437c8bfa2fc7b7f660e51eba0c0e797baef36440cb19a889bb1dfdcce70df5cc92e2225b4916cafd7418c0a73fcfff9f9839ac89913
7
- data.tar.gz: 925c55e4794ac8396497d8c70dbd9d3a8fc7b70be044152f0617849ff555e74a92ddb2cf3b65d05d103e77a05b108dbe255f31957eb45c16ce4a424d6542e670
6
+ metadata.gz: 537d07364819de492a1b66d6b9f016cdc619c7207f3f86b28673366119bfe5fc8b270760fb1531458ba1293310118a7541a1c844b41618f178b9070274edbef5
7
+ data.tar.gz: 2e0d5b5d7e28ebcc2d55e931386a27cf2954b0bd803243166631197c6779608e7acfd0f8e0c652e5e4047e981bbe42e66e399da6370c37bb075be080b713d03c
data/README.md CHANGED
@@ -1,8 +1,23 @@
1
+ ![](https://img.shields.io/badge/ruby-2.5%2B-red.svg)
2
+ ![Gem Version](https://img.shields.io/gem/v/camaleon_image_optimizer.svg?colorB=blue)
3
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
4
+ [![Build Status](https://travis-ci.com/brian-kephart/camaleon_lazy_loader.svg?branch=master)](https://travis-ci.org/brian-kephart/camaleon_lazy_loader)
5
+
1
6
  # CamaleonLazyLoader
2
7
  This plugin adds a `loading="lazy"` attribute to `<img>` and `<iframe>` tags rendered by [Camaleon CMS](https://github.com/owen2345/camaleon-cms).
3
8
  - This attribute will be added to tags on all server-rendered pages.
4
9
  - Existing loading attributes will not be overwritten, so you can still set individual tags to `loading="eager"` or `loading="auto"`
5
10
 
11
+ ## How it works
12
+ 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.
13
+
14
+ ### If the Front Cache plugin is active
15
+ - For pages that are not cached, this plugin works as described above.
16
+ - For pages that are cached:
17
+ - The affects of this plugin are applied to the cache entry when it is saved using the `front_cache_writing_cache` hook.
18
+ - There is no processing when reading from the cache.
19
+ - Activating/deactivating this plugin will clear the Front Cache.
20
+
6
21
  ## Usage
7
22
  Just turn on the plugin in your admin settings.
8
23
 
@@ -7,7 +7,7 @@ module Plugins::CamaleonLazyLoader::MainHelper
7
7
  end
8
8
 
9
9
  def apply_lazy_loading(html)
10
- doc = Nokogiri::HTML::DocumentFragment.parse html
10
+ doc = Nokogiri::HTML.parse html
11
11
  nodes = doc.css "img, iframe"
12
12
  nodes.each { |node| node["loading"] ||= "lazy" }
13
13
  doc.to_html
@@ -1,3 +1,3 @@
1
1
  module CamaleonLazyLoader
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: camaleon_lazy_loader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Kephart
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-01 00:00:00.000000000 Z
11
+ date: 2020-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: camaleon_cms
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  requirements: []
105
- rubygems_version: 3.1.2
105
+ rubygems_version: 3.1.4
106
106
  signing_key:
107
107
  specification_version: 4
108
108
  summary: Adds browser-native loading="lazy" attribute to images and iframes rendered