Sha256: a6d998381d4071f5ea8f5fe317f6fb48336aa5d2e6dde4dfe625faa6e45e6c68

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

# require 'action_view/helpers/asset_tag_helper'

# TODO:
#   * find a mechanism to do this without monkey-patching Rails
#   * add an autoload option to load all from plugins, or similar
#   * allow engines to indicate (automatically when #register is called?)
#     which assets to include.

module ActionView::Helpers::AssetTagHelper
  # def expand_javascript_sources_with_engine_assets(sources, recursive = false)
  #   if sources.include?(:all)
  #     result = (determine_source(:defaults, @@javascript_expansions).dup | expand_javascript_sources_without_engine_assets(sources, recursive))
  #     result.map! { |entry| entry =~ /\.js$/ ? entry : "#{entry}.js" }
  #     return result.uniq
  #   else
  #     raise NotImplementedError
  #   end
  # end
  # alias_method_chain :expand_javascript_sources, :engine_assets
  #
  def asset_file_path_with_engine_assets(path)
    primary = asset_file_path_without_engine_assets(path)
    return primary if File.exist?(primary)

    EngineAssets::PublicLocator.locate(path)
  end
  alias_method_chain :asset_file_path, :engine_assets
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
engine-assets-0.6.0.pre1 lib/engine_assets/extensions/action_view/helpers/asset_tag_helper.rb