class Jekyll::FontAwesomeSass::Generator

Public Instance Methods

generate(site) click to toggle source
# File lib/jekyll-font-awesome-sass.rb, line 10
def generate(site)
  @site = site

  # Add our static files to Jekyll's native static file support
  @site.static_files.concat static_files if assets_enabled?
end

Private Instance Methods

asset_files() click to toggle source

Return an array of paths to static files that should be included in the generated site.

Note: All paths are relative to the assets_path directory

# File lib/jekyll-font-awesome-sass.rb, line 44
def asset_files
  asset_files = []
  Find.find(assets_path).each do |path|
    next if File.directory?(path)
    next if path.include?(stylesheets_path)
    asset_files << path.sub(assets_path, 'assets')
  end
  asset_files
end
assets_enabled?() click to toggle source

Has the user explictly disabled asset support by adding The following to their `_config.yml` file:

font-awesome

assets: false
# File lib/jekyll-font-awesome-sass.rb, line 24
def assets_enabled?
  return false if @site.config['font-awesome'].nil?
  @site.config['font-awesome']['assets'] == true
end
assets_path() click to toggle source

Absolute path to font-awesome-sass's vendored static assets

# File lib/jekyll-font-awesome-sass.rb, line 55
def assets_path
  @assets_path ||= FontAwesome::Sass.assets_path
end
static_files() click to toggle source

Returns an array of Jekyll::StaticFile instances for each file in asset_files. Files are prefixed with an `assets/` directory

# File lib/jekyll-font-awesome-sass.rb, line 31
def static_files
  source = File.dirname(assets_path)
  asset_files.map do |file|
    dir = File.dirname(file)
    file_name = File.basename(file)
    Jekyll::StaticFile.new @site, source, dir, file_name
  end
end
stylesheets_path() click to toggle source

Absolute path to font-awesome-sass's stylesheets directory Which should be excluded because it's processed by SaSS

# File lib/jekyll-font-awesome-sass.rb, line 61
def stylesheets_path
  @stylesheets_path ||= File.expand_path 'stylesheets/', assets_path
end