Class: Jekyll::JekyllRetinamagick::MiniMagickGenerator

Inherits:
Generator
  • Object
show all
Defined in:
lib/jekyll-retinamagick.rb

Instance Method Summary collapse

Instance Method Details

#generate(site) ⇒ Object

Find all image files in the source directories of the presets specified in the site config. Add a GeneratedImageFile to the static_files stack for later processing.



81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/jekyll-retinamagick.rb', line 81

def generate(site)
  return unless site.config['retinamagick']

  site.config['retinamagick'].each_pair do |name, preset|
    Dir.glob(File.join(site.source, preset['source'], "*.{png,jpg,jpeg,gif}")) do |source|
      site.static_files << GeneratedImageFile.new(site, site.source, preset['destination'], File.basename(source), preset.clone, false)
      if preset.has_key?("resize")
        site.static_files << GeneratedImageFile.new(site, site.source, preset['destination'], File.basename(source), preset.clone, true)
      end
    end
  end
end