Module: JekyllLazyLoadImage

Defined in:
lib/jekyll-lazy-load-image.rb,
lib/jekyll-lazy-load-image/config.rb,
lib/jekyll-lazy-load-image/version.rb,
lib/jekyll-lazy-load-image/translator.rb,
lib/jekyll-lazy-load-image/site-config.rb

Defined Under Namespace

Classes: Config, SiteConfig, Translator

Constant Summary collapse

HOOK_KEY =
:jekyll_lazy_load_image
VERSION =
"0.3.3"

Class Method Summary collapse

Class Method Details

.configObject



18
19
20
# File 'lib/jekyll-lazy-load-image.rb', line 18

def config
  @config ||= Config.new
end

.configure {|config| ... } ⇒ Object

Yields:



14
15
16
# File 'lib/jekyll-lazy-load-image.rb', line 14

def configure
  yield(config)
end

.executeObject



22
23
24
25
26
27
28
29
30
# File 'lib/jekyll-lazy-load-image.rb', line 22

def execute
  Jekyll::Hooks.register(config.owners, :post_render) do |post|
    site_config = JekyllLazyLoadImage::SiteConfig.new(
      post.site.config[JekyllLazyLoadImage::SiteConfig::CONFIG_KEY]
    )
    auto_lazy_load_image = JekyllLazyLoadImage::Translator.new(post.output, site_config)
    post.output = auto_lazy_load_image.translate
  end
end