Skip to content

Commit

Permalink
Fix selector parsing by removing BOM
Browse files Browse the repository at this point in the history
  • Loading branch information
qbart committed Oct 10, 2016
1 parent ff04cfa commit f21c838
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/roadie/stylesheet.rb
Expand Up @@ -6,6 +6,8 @@ module Roadie
# @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.
Expand All @@ -14,7 +16,7 @@ class Stylesheet
# @param [String] css
def initialize(name, css)
@name = name
@blocks = parse_blocks(css)
@blocks = parse_blocks(css.sub(BOM, ""))
end

# @yield [selector, properties]
Expand Down

0 comments on commit f21c838

Please sign in to comment.