Module: Jammit::Lite::Helper

Defined in:
lib/jammit/lite/helper.rb

Instance Method Summary collapse

Instance Method Details

#include_javascripts(*bundles) ⇒ Object

creates <script> tags for Jammit js bundles in development, creates <script> tag for each individual file in bundles in production, creates <script> tag for each bundle



12
13
14
15
16
17
# File 'lib/jammit/lite/helper.rb', line 12

def include_javascripts(*bundles)
  bundles.map! { |name| Jammit::Lite::Bundle.new(:javascripts => name)  }
  return include_individual_javascripts(bundles) unless Rails.env.production?    
  tags = bundles.map { |bundle| javascript_include_tag(bundle.path) }
  tags.join("\n")
end

#include_stylesheets(*bundles) ⇒ Object

creates <link> tags for Jammit css bundles in development, creates <link> tag for each individual file in bundles in production, creates <link> tag for each bundle



43
44
45
46
47
48
# File 'lib/jammit/lite/helper.rb', line 43

def include_stylesheets(*bundles)        
  bundles.map! { |name| Jammit::Lite::Bundle.new(:stylesheets => name)  }
  return include_individual_stylesheets(bundles) unless Rails.env.production?    
  tags = bundles.map { |bundle| stylesheet_link_tag(bundle.path) }
  tags.join("\n")
end

#include_templates(*bundles) ⇒ Object

creates <script> tags for Jammit templates



20
21
22
23
# File 'lib/jammit/lite/helper.rb', line 20

def include_templates(*bundles)
  tags = bundles.map { |bundle| javascript_include_tag("/assets/#{bundle}.jst")  }
  tags.join("\n")
end