Module: BistroCar::Helpers

Defined in:
lib/bistro_car/helpers.rb

Instance Method Summary collapse

Instance Method Details

#coffee_script(&block) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/bistro_car/helpers.rb', line 16

def coffee_script(&block)
  output = BistroCar.compile(capture(&block))
  
  concat (:script, <<-JAVASCRIPT, :type => 'text/javascript', :charset => 'utf-8')
    //<![CDATA[
      #{output}
    //]]>
  JAVASCRIPT
end

#coffee_script_bundle(*bundles) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/bistro_car/helpers.rb', line 4

def coffee_script_bundle(*bundles)
  options = bundles.extract_options!
  options[:mode] ||= BistroCar.mode

  bundles = [:default, *bundles].map do |name|
    bundle = Bundle.new(name)
    render_cs_bundle(bundle, options[:mode])
  end.join
  bundles = bundles.html_safe if bundles.respond_to?(:html_safe)
  bundles
end