Sha256: d571bb7c48e4c7cc5654f37e599f5a85ffcda5e8d4e5668299baa5d52a918b39

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

module Compressible
  module Assetable
    
    def self.included(base)
      base.extend ClassMethods
    end
    
    module ClassMethods
    
      def javascripts(hash)
        hash.each do |to, paths|
          paths << {:to => to}
          javascript(*paths)
        end
      end
      alias_method :add_javascripts, :javascripts

      def stylesheets(hash)
        hash.each do |to, paths|
          paths << {:to => to}
          stylesheet(*paths)
        end
      end
      alias_method :add_stylesheets, :stylesheets
  
      def javascript(*args)
        paths = args.dup
        options = paths.extract_options!
        to = asset_name(options[:to])
        add_to_config(:js, to, paths)
        write_javascript(*args) unless config[:read_only] == true
      end
      alias_method :add_javascript, :javascript
      alias_method :js, :javascript

      def stylesheet(*args)
        paths = args.dup
        options = paths.extract_options!
        to = asset_name(options[:to])
        add_to_config(:css, to, paths)
        write_stylesheet(*args) unless config[:read_only] == true
      end
      alias_method :add_stylesheet, :stylesheet
      alias_method :css, :stylesheet
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
compressible-0.0.2.4 lib/compressible/assetable.rb