Module: Compressible::Assetable::ClassMethods

Defined in:
lib/compressible/assetable.rb

Instance Method Summary collapse

Instance Method Details

#javascript(*args, &block) ⇒ Object Also known as: add_javascript, js



26
27
28
29
30
31
32
33
# File 'lib/compressible/assetable.rb', line 26

def javascript(*args, &block)
  paths = args.dup.flatten
  options = paths.extract_options!
  to = asset_name(options[:to])
  add_to_config(:js, to, paths)
  write_javascript(*args, &block) unless config[:read_only] == true
  to
end

#javascripts(hash, &block) ⇒ Object Also known as: add_javascripts



10
11
12
13
14
15
# File 'lib/compressible/assetable.rb', line 10

def javascripts(hash, &block)
  hash.each do |to, paths|
    paths << {:to => to}
    javascript(*paths, &block)
  end
end

#stylesheet(*args, &block) ⇒ Object Also known as: add_stylesheet, css



37
38
39
40
41
42
43
44
# File 'lib/compressible/assetable.rb', line 37

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

#stylesheets(hash, &block) ⇒ Object Also known as: add_stylesheets



18
19
20
21
22
23
# File 'lib/compressible/assetable.rb', line 18

def stylesheets(hash, &block)
  hash.each do |to, paths|
    paths << {:to => to}
    stylesheet(*paths, &block)
  end
end