lib/css_parser/parser.rb in css_parser-1.11.0 vs lib/css_parser/parser.rb in css_parser-1.12.0
- old
+ new
@@ -37,10 +37,11 @@
def initialize(options = {})
@options = {absolute_paths: false,
import: true,
io_exceptions: true,
+ rule_set_exceptions: true,
capture_offsets: false}.merge(options)
# array of RuleSets
@rules = []
@@ -165,9 +166,11 @@
#
# +media_types+ can be a symbol or an array of symbols.
def add_rule!(selectors, declarations, media_types = :all)
rule_set = RuleSet.new(selectors, declarations)
add_rule_set!(rule_set, media_types)
+ rescue ArgumentError => e
+ raise e if @options[:rule_set_exceptions]
end
# Add a CSS rule by setting the +selectors+, +declarations+, +filename+, +offset+ and +media_types+.
#
# +filename+ can be a string or uri pointing to the file or url location.