Class: WebResourceBundler::Filters::CompressFilter::Filter
- Inherits:
-
BaseFilter
- Object
- BaseFilter
- WebResourceBundler::Filters::CompressFilter::Filter
- Defined in:
- lib/web_resource_bundler/filters/compress_filter.rb
Constant Summary collapse
- FILE_PREFIX =
'min_'
Instance Attribute Summary
Attributes inherited from BaseFilter
Instance Method Summary collapse
- #apply!(block_data) ⇒ Object
-
#initialize(settings, file_manager) ⇒ Filter
constructor
A new instance of Filter.
- #set_settings(settings) ⇒ Object
Constructor Details
#initialize(settings, file_manager) ⇒ Filter
Returns a new instance of Filter.
6 7 8 9 10 |
# File 'lib/web_resource_bundler/filters/compress_filter.rb', line 6 def initialize(settings, file_manager) super(settings, file_manager) @js_compressor = YUI::JavaScriptCompressor.new(:munge => settings[:obfuscate_js]) @css_compressor = YUI::CssCompressor.new end |
Instance Method Details
#apply!(block_data) ⇒ Object
19 20 21 22 23 |
# File 'lib/web_resource_bundler/filters/compress_filter.rb', line 19 def apply!(block_data) compress_styles!(block_data.styles) compress_scripts!(block_data.scripts) block_data end |
#set_settings(settings) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/web_resource_bundler/filters/compress_filter.rb', line 12 def set_settings(settings) if @settings[:obfuscate_js] != settings[:obfuscate_js] @js_compressor = YUI::JavaScriptCompressor.new(:munge => settings[:obfuscate_js]) end @settings = settings end |