Class: AlSearch::AssetsGenerator

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

Instance Method Summary collapse

Instance Method Details

#generate(site) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/al_search.rb', line 15

def generate(site)
  plugin_lib_path = File.expand_path('.', __dir__)
  search_asset_root = File.join(plugin_lib_path, ASSETS_DIR, PLUGIN_NAME, JS_DIR)
  Dir.glob(File.join(search_asset_root, '**', '*')).each do |source_path|
    next if File.directory?(source_path)

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