Method: RSAC::StyleSheet#to_css

Defined in:
lib/antisamy/csspool/rsac/stylesheet/stylesheet.rb

#to_cssObject



51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/antisamy/csspool/rsac/stylesheet/stylesheet.rb', line 51

def to_css
  rules_by_property.map do |properties, rules|
    rules.map { |rule| rule.selector.to_css }.sort.join(', ') + " {\n" +
      properties.map { |key,value,important|
        # Super annoying.  If the property is font-family, its supposed to

        # be commas

        join_val = ('font-family' == key) ? ', ' : ' '
        values = [value].flatten.join(join_val)
        "#{key}:#{values}#{important ? ' !important' : ''};"
      }.join("\n") + "\n}"
  end.sort.join("\n")
end