Module: AssetPages::Jekyll::LiquidHelper::InstanceMethods

Defined in:
lib/asset_pages/jekyll/liquid_helper.rb

Instance Method Summary collapse

Instance Method Details

#compute_asset_path(path, options = {}) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/asset_pages/jekyll/liquid_helper.rb', line 55

def compute_asset_path(path, options = {})
  asset = lookup_asset_for_path(path, options)

  if asset
    if debug_assets && options[:debug] != false
      asset.to_a.each do |subasset|
        write_static_asset({}.tap { |h| subasset.encode_with(h) }.tap { |h| h["source"] ||= subasset.source })
      end
    else
      write_static_asset({}.tap { |h| asset.encode_with(h) }.tap { |h| h["source"] ||= asset.source })
    end
  elsif !assets_environment
    asset_filename = assets_manifest.assets[path]

    write_static_asset({"filename" => asset_filename}) \
      if asset_filename
  end

  # Use relative paths, since the filesystem might be used to serve up pages.
  super(path, options)
end