Module: ActionView::Helpers::AssetTagHelper::StylesheetTagHelpers::ClassMethods

Defined in:
actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb

Instance Method Summary collapse

Instance Method Details

#register_stylesheet_expansion(expansions) ⇒ Object

Register one or more stylesheet files to be included when symbol is passed to stylesheet_link_tag. This method is typically intended to be called from plugin initialization to register stylesheet files that the plugin installed in public/stylesheets.

ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion :monkey => ["head", "body", "tail"]

stylesheet_link_tag :monkey # =>
  <link href="/stylesheets/head.css"  media="screen" rel="stylesheet" type="text/css" />
  <link href="/stylesheets/body.css"  media="screen" rel="stylesheet" type="text/css" />
  <link href="/stylesheets/tail.css"  media="screen" rel="stylesheet" type="text/css" />


44
45
46
47
48
49
# File 'actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb', line 44

def register_stylesheet_expansion(expansions)
  style_expansions = StylesheetIncludeTag.expansions
  expansions.each do |key, values|
    style_expansions[key] = (style_expansions[key] || []) | Array(values)
  end
end