Class: AlImgTools::AssetsGenerator

Inherits:
Jekyll::Generator
  • Object
show all
Defined in:
lib/al_img_tools.rb

Instance Method Summary collapse

Instance Method Details

#generate(site) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/al_img_tools.rb', line 28

def generate(site)
  plugin_lib_path = File.expand_path('.', __dir__)
  assets_root = File.join(plugin_lib_path, ASSETS_DIR, PLUGIN_NAME)

  Dir.glob(File.join(assets_root, '**', '*')).sort.each do |source_path|
    next if File.directory?(source_path)

    relative_dir = File.dirname(source_path).sub("#{plugin_lib_path}/", '')
    site.static_files << PluginStaticFile.new(site, plugin_lib_path, relative_dir, File.basename(source_path))
  end
end