Sha256: e932e9f7146e0a5e50ad3eddbfd114d06436893c6e963b859f630934d58ef5dd

Contents?: true

Size: 1.21 KB

Versions: 20

Compression:

Stored size: 1.21 KB

Contents

ActionView::Base.class_eval do 
  def merged_javascripts *package_names
    merged_packages 'javascripts', package_names
  end

  def merged_stylesheets *package_names
    merged_packages 'stylesheets', package_names
  end
  
  protected
    def merged_packages thetype, package_names
      found_packages = {}
      
      package_names.each do |pname|
        AssetPackager.definitions.each do |path, package_types|
          package_types.each do |type, packages|
            next unless type == thetype
            packages.each do |name, files|
              found_packages[name] = files if name == pname.to_s
            end
          end
        end
      end
      
      found_packages.size.should! :==, package_names.size
          
      if AssetPackager.merge_environments.include? Rails.env
        found_packages.collect do |name, files| 
          AssetPackager.filename_for_builded_package thetype, name
        end
      else
        list = []
        found_packages.each do |name, files|
          files.each do |fname|
            fname = if fname =~ /\A\//
              fname
            else
              "/#{fname}"
            end
            list.push fname
          end
        end
        list
      end
    end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rails-ext-0.3.6 lib/rails_ext/asset_packager/action_view.rb
rails-ext-0.3.5 lib/rails_ext/asset_packager/action_view.rb
rails-ext-0.3.4 lib/rails_ext/asset_packager/action_view.rb
rails-ext-0.3.3 lib/rails_ext/asset_packager/action_view.rb
rails-ext-0.3.2 lib/rails_ext/asset_packager/action_view.rb
rails-ext-0.3.1 lib/rails_ext/asset_packager/action_view.rb
rails-ext-0.3 lib/rails_ext/asset_packager/action_view.rb
rails-ext-0.2.21 lib/asset_packager/action_view.rb
rails-ext-0.2.20 lib/asset_packager/action_view.rb
rails-ext-0.2.19 lib/asset_packager/action_view.rb
rails-ext-0.2.18 lib/asset_packager/action_view.rb
rails-ext-0.2.17 lib/asset_packager/action_view.rb
rails-ext-0.2.16 lib/asset_packager/action_view.rb
rails-ext-0.2.15 lib/asset_packager/action_view.rb
rails-ext-0.2.14 lib/asset_packager/action_view.rb
rails-ext-0.2.13 lib/asset_packager/action_view.rb
rails-ext-0.2.12 lib/asset_packager/action_view.rb
rails-ext-0.2.11 lib/asset_packager/action_view.rb
rails-ext-0.2.10 lib/asset_packager/action_view.rb
rails-ext-0.2.9 lib/asset_packager/action_view.rb