Skip to content

Commit 236552e

Browse files
committed
Fixes parser error bug when trying to parse blank files
This fix is a little hokey but it'll do for now. refs: zmoazeni#37
1 parent e6c3b80 commit 236552e

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* Fixes line/column output during parser errors
1010
* --compass now grabs config.rb by default if it exists
1111
* Adds --compass-with-config that lets users specify a config
12+
* Fixes parser error bug when trying to parse blank files
1213

1314
## 1.0.0 - 4/7/2013 ##
1415

lib/csscss/cli.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,15 @@ def execute
4242
open(filename) {|f| f.read }
4343
end
4444

45-
RedundancyAnalyzer.new(contents).redundancies(
46-
minimum: @minimum,
47-
ignored_properties: @ignored_properties,
48-
ignored_selectors: @ignored_selectors
49-
)
45+
if contents.strip.empty?
46+
{}
47+
else
48+
RedundancyAnalyzer.new(contents).redundancies(
49+
minimum: @minimum,
50+
ignored_properties: @ignored_properties,
51+
ignored_selectors: @ignored_selectors
52+
)
53+
end
5054
end
5155

5256
combined_redundancies = all_redundancies.inject({}) do |combined, redundancies|

0 commit comments

Comments
 (0)