Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

quick fix for haml

  • Loading branch information...
commit 3903c53c4647e0ebcf8f77e16ac51ecb923aee83 1 parent 6e7681d
@bratish authored
Showing with 6 additions and 0 deletions.
  1. +6 −0 lib/stylaudit/pick_css_selectors.rb
View
6 lib/stylaudit/pick_css_selectors.rb
@@ -2,12 +2,18 @@ class PickCssSelectors
def initialize(f)
@content = File.open(f, 'r').read
+ @file_type = File.basename(f).split(".").last.strip
end
def classes
class_references = @content.grep(/[:]?class[ ]*=[ >]?/).map do |line|
line.scan(/[:]?class[ ]*=[ >]?[ ]*[\\]?["|']([\w <%=\->:,?@'"\.\(\)#\{\}]*)[ ]*[\\]?["|']/)
end.flatten.compact.reject { |s| s.strip.empty? }
+
+ if @file_type == 'haml' #quick fix. need to have a rule to eliminate ruby class.method references
+ class_references += @content.scan(/\.([\w\-]+)/).flatten
+ end
+
class_references_with_script_tags = class_references.select do |str|
str.scan(/(<%[\w =\-:,?@'"\.\(\)#\{\}]*%>)/).size > 0
end
Please sign in to comment.
Something went wrong with that request. Please try again.