Sha256: f28e288dc1969e63558480739f2c495a922c482ae1c8ee4c409184d48ba98c1f

Contents?: true

Size: 912 Bytes

Versions: 5

Compression:

Stored size: 912 Bytes

Contents

class SmartAsset
  module Helper
    
    def javascript_include_merged(*javascripts)
      output = javascript_paths(*javascripts).collect { |js|
        "<script src=\"#{js}\" type=\"text/javascript\"></script>"
      }.join("\n")
      defined?(Rails) && Rails.version[0..0] == '3' ? output.html_safe : output
    end
    
    def stylesheet_link_merged(*stylesheets)
      output = stylesheet_paths(*stylesheets).collect { |css|
        "<link href=\"#{css}\" media=\"screen\" rel=\"Stylesheet\" type=\"text/css\" />"
      }.join("\n")
      defined?(Rails) && Rails.version[0..0] == '3' ? output.html_safe : output
    end
    
    def javascript_paths(*javascripts)
      javascripts.collect { |js| SmartAsset.paths('javascripts', js) }.flatten.uniq
    end
    
    def stylesheet_paths(*stylesheets)
      stylesheets.collect { |css| SmartAsset.paths('stylesheets', css) }.flatten.uniq
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
smart_asset-0.2.1 lib/smart_asset/helper.rb
smart_asset-0.2.0 lib/smart_asset/helper.rb
smart_asset-0.1.3 lib/smart_asset/helper.rb
smart_asset-0.1.2 lib/smart_asset/helper.rb
smart_asset-0.1.1 lib/smart_asset/helper.rb