Module: WebpackerToppings::Helpers::Packs
- Defined in:
- lib/webpacker_toppings/helpers/packs.rb
Instance Method Summary collapse
-
#javascript_packs_list ⇒ Object
Retrieve javascript packs declared in your templates Example : <%= javascript_packs_with_chunks_tag *javascript_packs_list %>.
-
#stylesheet_packs_list ⇒ Object
Retrieve stylesheet packs declared in your templates Example : <%= stylesheet_packs_with_chunks_tag *stylesheet_packs_list %>.
-
#use_javascript_pack(*packs) ⇒ Object
Declare a javascript pack (or many) you want to use in a template Example : <%= use_javascript_pack(:foo, :bar) %>.
-
#use_stylesheet_pack(*packs) ⇒ Object
Declare a stylesheet pack (or many) you want to use in a template Example : <%= use_stylesheet_pack(:baz) %>.
Instance Method Details
#javascript_packs_list ⇒ Object
Retrieve javascript packs declared in your templates Example : <%= javascript_packs_with_chunks_tag *javascript_packs_list %>
6 7 8 9 10 |
# File 'lib/webpacker_toppings/helpers/packs.rb', line 6 def javascript_packs_list return unless content_for?(:javascript_packs_list) Array(content_for(:javascript_packs_list).split(';')).reject(&:empty?) end |
#stylesheet_packs_list ⇒ Object
Retrieve stylesheet packs declared in your templates Example : <%= stylesheet_packs_with_chunks_tag *stylesheet_packs_list %>
14 15 16 17 18 |
# File 'lib/webpacker_toppings/helpers/packs.rb', line 14 def stylesheet_packs_list return unless content_for?(:stylesheet_packs_list) Array(content_for(:stylesheet_packs_list).split(';')).reject(&:empty?) end |
#use_javascript_pack(*packs) ⇒ Object
Declare a javascript pack (or many) you want to use in a template Example : <%= use_javascript_pack(:foo, :bar) %>
22 23 24 |
# File 'lib/webpacker_toppings/helpers/packs.rb', line 22 def use_javascript_pack(*packs) content_for(:javascript_packs_list) { "#{packs.join(';')};" } end |
#use_stylesheet_pack(*packs) ⇒ Object
Declare a stylesheet pack (or many) you want to use in a template Example : <%= use_stylesheet_pack(:baz) %>
28 29 30 |
# File 'lib/webpacker_toppings/helpers/packs.rb', line 28 def use_stylesheet_pack(*packs) content_for(:stylesheet_packs_list) { "#{packs.join(';')};" } end |