Class: WebResourceBundler::Filters::BundleFilter::Filter

Inherits:
WebResourceBundler::Filters::BaseFilter show all
Defined in:
lib/web_resource_bundler/filters/bundle_filter.rb

Instance Attribute Summary

Attributes inherited from WebResourceBundler::Filters::BaseFilter

#settings

Instance Method Summary collapse

Methods inherited from WebResourceBundler::Filters::BaseFilter

#set_settings

Constructor Details

#initialize(settings, file_manager) ⇒ Filter

Returns a new instance of Filter.



9
10
11
12
# File 'lib/web_resource_bundler/filters/bundle_filter.rb', line 9

def initialize(settings, file_manager)
  super(settings, file_manager)
  @packager = ResourcePackager.new(@settings, @file_manager)
end

Instance Method Details

#apply!(block_data) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/web_resource_bundler/filters/bundle_filter.rb', line 14

def apply!(block_data)
  new_files        =  []
  new_files        << create_css_bundle(block_data.styles) if block_data.styles.any?
  new_files        << create_js_bundle(block_data.scripts) if block_data.scripts.any?
  block_data.files =  new_files
  block_data
end