lib/texture_packer.rb in texture_packer-1.6.3 vs lib/texture_packer.rb in texture_packer-1.7.0
- old
+ new
@@ -9,10 +9,11 @@
attr_reader :output_paths_mapping
SPLIT_BY_MOBILE = 'mobile'
SPLIT_BY_I18N = 'i18n'
SPLIT_BY_I18N_AND_MOBILE = 'i18n_and_mobile'
+ SELECTOR_ORDER = %w[:hover :active :disabled].freeze
def initialize(dir_name, output_paths_mapping, content, split_type = nil)
@output_paths_mapping = output_paths_mapping
@content = content.dup
@split_type = split_type
@@ -149,10 +150,10 @@
@css = css
end
end
def generate_css
- inner_css = @hash.map do |prefix, obj|
+ inner_css = @hash.sort_by{|prefix, obj| SELECTOR_ORDER.index(prefix) || SELECTOR_ORDER.size }.map do |prefix, obj|
case prefix
when nil, ''
[obj.generate_css]
when /\A:/
["&#{prefix}, &.#{prefix[1..-1]}{ ", obj.generate_css, ' }']