Juice10-bogus_sass_checker 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/bin/checksass CHANGED
@@ -10,9 +10,18 @@ unless File.exists?(SASS_DIRECTORY_PATH)
10
10
  end
11
11
 
12
12
  stylesheets = Dir.new(SASS_DIRECTORY_PATH).entries - ['.', '..']
13
+ puts "found #{stylesheets.size} files in the sass directory...\npossible unused CSS selectors:"
13
14
  stylesheets.each do |sass_file|
14
15
  stylesheet = open(SASS_DIRECTORY_PATH + sass_file).read
15
- stylesheet.scan(/^(?:[^:]*)([#\.](?:[\w]*))/).each do |match|
16
+ # finds all selectors that start with # or . but don't have a :, = or + infront of them
17
+ # desired effects:
18
+ # finds most #ids and .classes
19
+ # doesn't match :color #CCC
20
+ # doesn't match !variable = #ABCDEF
21
+ # doesn't match +mixin(10.5%, #ABCDEF)
22
+ # undesired side effects:
23
+ # it doesn't match ids or classes in the sibling selector: h2 + p.sibling
24
+ stylesheet.scan(/^(?:[^:=+]*)([#\.](?:[\w]*))/).each do |match|
16
25
  result = search_contents_for(match)
17
26
  if result == ""
18
27
  puts match
@@ -3,8 +3,8 @@ Gem::Specification.new do |s|
3
3
  s.name = 'bogus_sass_checker'
4
4
  s.summary = "Checks your rails projects Sass files for #ids and .classes and checks if you are using them in the rest of your rails project."
5
5
  s.description = "Checks your rails projects Sass files for #ids and .classes and checks if you are using them in the rest of your rails project. (Depends on ack)"
6
- s.version = '0.1.2'
7
- s.date = '2008-12-08'
6
+ s.version = '0.1.3'
7
+ s.date = '2009-07-17'
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Justin Halsall"]
10
10
  s.email = "zero200@gmail.com"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Juice10-bogus_sass_checker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Halsall
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-08 00:00:00 -08:00
12
+ date: 2009-07-17 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15