Class: CSSminify2Enhanced::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/cssminify2/enhanced.rb

Overview

Configuration class for enhanced features

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cssminify2/enhanced.rb', line 23

def initialize
  # All new features are opt-in by default for compatibility
  @merge_duplicate_selectors = false
  @optimize_shorthand_properties = false  
  @advanced_color_optimization = false
  @preserve_ie_hacks = true
  @compress_css_variables = false
  @strict_error_handling = false
  @generate_source_map = false
  @statistics_enabled = false
end

Instance Attribute Details

#advanced_color_optimizationObject

Returns the value of attribute advanced_color_optimization.



18
19
20
# File 'lib/cssminify2/enhanced.rb', line 18

def advanced_color_optimization
  @advanced_color_optimization
end

#compress_css_variablesObject

Returns the value of attribute compress_css_variables.



18
19
20
# File 'lib/cssminify2/enhanced.rb', line 18

def compress_css_variables
  @compress_css_variables
end

#generate_source_mapObject

Returns the value of attribute generate_source_map.



18
19
20
# File 'lib/cssminify2/enhanced.rb', line 18

def generate_source_map
  @generate_source_map
end

#merge_duplicate_selectorsObject

Returns the value of attribute merge_duplicate_selectors.



18
19
20
# File 'lib/cssminify2/enhanced.rb', line 18

def merge_duplicate_selectors
  @merge_duplicate_selectors
end

#optimize_shorthand_propertiesObject

Returns the value of attribute optimize_shorthand_properties.



18
19
20
# File 'lib/cssminify2/enhanced.rb', line 18

def optimize_shorthand_properties
  @optimize_shorthand_properties
end

#preserve_ie_hacksObject

Returns the value of attribute preserve_ie_hacks.



18
19
20
# File 'lib/cssminify2/enhanced.rb', line 18

def preserve_ie_hacks
  @preserve_ie_hacks
end

#statistics_enabledObject

Returns the value of attribute statistics_enabled.



18
19
20
# File 'lib/cssminify2/enhanced.rb', line 18

def statistics_enabled
  @statistics_enabled
end

#strict_error_handlingObject

Returns the value of attribute strict_error_handling.



18
19
20
# File 'lib/cssminify2/enhanced.rb', line 18

def strict_error_handling
  @strict_error_handling
end

Class Method Details

.aggressiveObject



40
41
42
43
44
45
46
47
# File 'lib/cssminify2/enhanced.rb', line 40

def self.aggressive
  config = new
  config.merge_duplicate_selectors = true
  config.optimize_shorthand_properties = true
  config.advanced_color_optimization = true
  config.compress_css_variables = true
  config
end

.conservativeObject

Preset configurations



36
37
38
# File 'lib/cssminify2/enhanced.rb', line 36

def self.conservative
  new # All features disabled
end

.modernObject



49
50
51
52
53
54
# File 'lib/cssminify2/enhanced.rb', line 49

def self.modern
  config = aggressive
  config.generate_source_map = true
  config.statistics_enabled = true
  config
end