Module: ActionView::Helpers::AssetTagHelper

Defined in:
lib/engine_assets/extensions/rails/assets.rb

Overview

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.

Instance Method Summary collapse

Instance Method Details

#asset_file_path_with_engine_assets(path) ⇒ Object



19
20
21
22
23
24
# File 'lib/engine_assets/extensions/rails/assets.rb', line 19

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

#expand_javascript_sources_with_engine_assets(sources, recursive = false) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/engine_assets/extensions/rails/assets.rb', line 8

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