Module: ActionView::Helpers::AssetTagHelper::JavascriptTagHelpers::ClassMethods
- Defined in:
- lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb
Instance Method Summary collapse
-
#register_javascript_expansion(expansions) ⇒ Object
Register one or more javascript files to be included when
symbol
is passed tojavascript_include_tag
.
Instance Method Details
#register_javascript_expansion(expansions) ⇒ Object
Register one or more javascript files to be included when symbol
is passed to javascript_include_tag
. This method is typically intended to be called from plugin initialization to register javascript files that the plugin installed in public/javascripts
.
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :monkey => ["head", "body", "tail"]
javascript_include_tag :monkey # =>
<script type="text/javascript" src="/javascripts/head.js"></script>
<script type="text/javascript" src="/javascripts/body.js"></script>
<script type="text/javascript" src="/javascripts/tail.js"></script>
67 68 69 70 71 72 |
# File 'lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb', line 67 def register_javascript_expansion(expansions) js_expansions = JavascriptIncludeTag.expansions expansions.each do |key, values| js_expansions[key] = (js_expansions[key] || []) | Array(values) end end |