lib/roadie/stylesheet.rb in roadie-3.1.1 vs lib/roadie/stylesheet.rb in roadie-3.2.0
- old
+ new
@@ -4,18 +4,20 @@
# It has a name and a list of {StyleBlock}s.
#
# @attr_reader [String] name the name of the stylesheet ("stylesheets/main.css", "Admin user styles", etc.). The name of the stylesheet will be visible if any errors occur.
# @attr_reader [Array<StyleBlock>] blocks
class Stylesheet
+ BOM = "\xEF\xBB\xBF".force_encoding('UTF-8').freeze
+
attr_reader :name, :blocks
# Parses the CSS string into a {StyleBlock}s and stores it.
#
# @param [String] name
# @param [String] css
def initialize(name, css)
@name = name
- @blocks = parse_blocks(css)
+ @blocks = parse_blocks(css.sub(BOM, ""))
end
# @yield [selector, properties]
# @yieldparam [Selector] selector
# @yieldparam [Array<StyleProperty>] properties