Module: RailsAssetPackager::AssetPackageHelper
- Defined in:
- lib/rails_asset_packager/asset_package_helper.rb
Instance Method Summary collapse
- #javascript_include_merged(*sources) ⇒ Object
- #should_merge? ⇒ Boolean
- #stylesheet_link_merged(*sources) ⇒ Object
Instance Method Details
#javascript_include_merged(*sources) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rails_asset_packager/asset_package_helper.rb', line 8 def javascript_include_merged(*sources) = sources.last.is_a?(Hash) ? sources.pop.stringify_keys : { } if sources.include?(:defaults) sources = sources[0..(sources.index(:defaults))] + ['prototype', 'effects', 'dragdrop', 'controls'] + (File.exists?("#{Rails.root}/public/javascripts/application.js") ? ['application'] : []) + sources[(sources.index(:defaults) + 1)..sources.length] sources.delete(:defaults) end sources.collect!{|s| s.to_s} sources = (should_merge? ? AssetPackage.targets_from_sources("javascripts", sources) : AssetPackage.sources_from_targets("javascripts", sources)) raw(sources.collect {|source| javascript_include_tag(source, ) }.join("\n")) end |
#should_merge? ⇒ Boolean
4 5 6 |
# File 'lib/rails_asset_packager/asset_package_helper.rb', line 4 def should_merge? AssetPackage.merge_environments.include?(Rails.env) end |
#stylesheet_link_merged(*sources) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rails_asset_packager/asset_package_helper.rb', line 27 def stylesheet_link_merged(*sources) = sources.last.is_a?(Hash) ? sources.pop.stringify_keys : { } sources.collect!{|s| s.to_s} sources = (should_merge? ? AssetPackage.targets_from_sources("stylesheets", sources) : AssetPackage.sources_from_targets("stylesheets", sources)) raw(sources.collect { |source| stylesheet_link_tag(source, ) }.join("\n")) end |