Sha256: 7d00cde6debccba71d8567569252a22e40bb5d409c2583e7792322664a8beb48
Contents?: true
Size: 916 Bytes
Versions: 2
Compression:
Stored size: 916 Bytes
Contents
module MasterView module Directives #creates a link_to class StylesheetLink < MasterView::DirectiveBase # /public\/stylesheets\/(.*)/ STYLESHEET_SRC_EXTRACT_REGEX = MasterView::ConfigSettings.template_asset_base_ref_pattern[:stylesheets] metadata :priority => :default, :category => 'asset', :description => 'Replaces the element using the Rails stylesheet_link_tag helper', :element_usage => 'link' attr_arg :src, :varargs => true event :element do if @src.nil? or @src.empty? if src_attr = element_attrs[:href] if match = STYLESHEET_SRC_EXTRACT_REGEX.match(src_attr) @src = [match[1]] else @src = [src_attr] end end end @src.collect! { |x| quote(x) } render erb_content('stylesheet_link_tag', :src) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
masterview-0.3.3 | lib/masterview/directives/stylesheet_link.rb |
masterview-0.3.4 | lib/masterview/directives/stylesheet_link.rb |