Module: BistroCar::Helpers

Defined in:
lib/bistro_car/helpers.rb

Instance Method Summary collapse

Instance Method Details

#coffee_script(&block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/bistro_car/helpers.rb', line 9

def coffee_script(&block)
  input = realign_indentation(capture(&block))
  output = CoffeeScript.compile(input)
  
  concat <<-HTML
    <script type="text/javascript" charset="utf-8">
    //<![CDATA[
      #{output}
    //]]>
    </script>
  HTML
end

#coffee_script_bundle(*bundles) ⇒ Object



3
4
5
6
7
# File 'lib/bistro_car/helpers.rb', line 3

def coffee_script_bundle(*bundles)
  options = bundles.extract_options!
  options[:mode] ||= BistroCar.mode
  [:default, *bundles].map { |name| Bundle.new(name).render(options[:mode]) }.join
end