Module: WebResourceBundler::RailsAppHelpers
- Defined in:
- lib/web_resource_bundler/rails_app_helpers.rb
Constant Summary collapse
- DATA_URI_START =
"<!--[if (!IE)|(gte IE 8)]><!-->"
- DATA_URI_END =
"<!--<![endif]-->"
- MHTML_START =
"<!--[if lte IE 7]>"
- MHTML_END =
"<![endif]-->"
Instance Method Summary collapse
Instance Method Details
#construct_block(block_data, settings) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/web_resource_bundler/rails_app_helpers.rb', line 21 def construct_block(block_data, settings) result = "" result << data_uri_part(block_data.base64_styles) result << mhtml_part(block_data.mhtml_styles) result << scripts_part(block_data.scripts) result << block_data.inline_block unless block_data.inline_block.blank? block_data.child_blocks.each do |block| result << construct_block(block, settings) end unless block_data.condition.empty? result = "<!--#{block_data.condition}>\n#{result}<![endif]-->\n" end #removing unnecessary new line symbols result.gsub!(/\n(\s)+/, "\n") result end |
#web_resource_bundler_process(&block) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/web_resource_bundler/rails_app_helpers.rb', line 8 def web_resource_bundler_process(&block) #getting ActionView::NonConcattingString #but we want simple string to escape problems result = String.new(capture(&block)) if !params['no_bundler'] && WebResourceBundler::Settings.correct? #we want to keep original string unchanged so we can return same content on error block_data = WebResourceBundler::Bundler.process(result.dup, request.host_with_port, request.protocol.gsub(/:\/\//,'')) #if everything ok with bundling we should construct resulted html content and change result result = construct_block(block_data, WebResourceBundler::Settings.settings) if block_data end construct_result(Rails::VERSION::STRING, result, block) end |