module ActionView::Helpers::AssetTagHelper::StylesheetTagHelpers::ClassMethods - actionpack-3.2.22 Documentation

# module ActionView::Helpers::AssetTagHelper::StylesheetTagHelpers::ClassMethods

### Public Instance Methods

register_stylesheet_expansion(expansions) click to toggle source

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" />

    # File 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