class Object

Public Instance Methods

fetch_theme_assets(base_path) click to toggle source

Simple helper to fetch assets from theme

# File lib/jekyll-theme-assets-updated.rb, line 17
def fetch_theme_assets(base_path)
  # Base path is resolved to nil unless it does exists
  return unless base_path
  # Similar snippets could be found in Jekyll's code base (namely reader.rb)
  dot_sources = Dir.chdir(base_path) { filter_entries(Dir.entries("."), base_path) }
  dot_sources.each do |source|
    # TODO: Replace with the link to the original thread on Github on the subject...
    jekyll.sprockets.append_path(File.join(base_path, source))
  end
end
filter_entries(entries, base_directory = nil) click to toggle source

Filter out any files/directories that are hidden or backup files (start with “.” or “#” or end with “~”), or contain site content (start with “_”), or are excluded in the site configuration, unless they are web server files such as '.htaccess'.

entries - The Array of String file/directory entries to filter. base_directory - The string representing the optional base directory.

Returns the Array of filtered entries.

# File lib/jekyll-theme-assets-updated.rb, line 42
def filter_entries(entries, base_directory = nil)
  Jekyll::EntryFilter.new(jekyll, base_directory).filter(entries)
end