Sha256: c8eb7107aec6495aa38c925dfb593af074a5cceb0dcac05ef3c05e80cd492908

Contents?: true

Size: 729 Bytes

Versions: 6

Compression:

Stored size: 729 Bytes

Contents

module CssSplitter
  module ApplicationHelper
    def split_stylesheet_link_tag(*sources)
      options     = sources.extract_options!
      split_count = options.delete(:split_count) || 2

      sources.map do |source|
        split_sources = (2..split_count).map { |index| "#{source}_split#{index}" }
        split_options = options.dup
        if Rails.env == 'development' && !split_options.key?(:debug)
          split_options[:debug] = false
        end
        split_sources << split_options

        [
          stylesheet_link_tag(source, options),
          "<!--[if lte IE 9]>",
          stylesheet_link_tag(*split_sources),
          "<![endif]-->"
        ]
      end.flatten.join("\n").html_safe
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
css_splitter-0.4.6 app/helpers/css_splitter/application_helper.rb
css_splitter-0.4.5 app/helpers/css_splitter/application_helper.rb
css_splitter-0.4.4 app/helpers/css_splitter/application_helper.rb
css_splitter-0.4.3 app/helpers/css_splitter/application_helper.rb
css_splitter-0.4.2 app/helpers/css_splitter/application_helper.rb
css_splitter-0.4.1 app/helpers/css_splitter/application_helper.rb