katiefenn / parker

Stylesheet analysis tool.
Other
2.47k stars 73 forks source link

Media queries are not counted properly #12

Closed spaceninja closed 10 years ago

spaceninja commented 10 years ago

Here's a test case: http://codepen.io/anon/pen/GEcmx

The CSS file contains 4100 rules, and 4101 selectors. 100 of those rules are nested inside two media queries.

Parker gives the following result:

PARKER-JS
Total Stylesheets: 1
Total Stylesheet Size: 140038
Total Rules: 4002
Total Selectors: 4003
Total Identifiers: 4005
Total Declarations: 4002
Selectors Per Rule: 1.0002498750624689
Identifiers Per Selector: 1.0004996252810392
Specificity Per Selector: 9.996002997751686
Top Selector Specificity: 10
Top Selector Specificity Selector: .redClass0101
Total Unique Colors: 0
Unique Colors: 
Total Important Keywords: 0

Looks like Parker evaluates the media query as a rule, but not the contents of the media query.

katiefenn commented 10 years ago

Thank you for raising this issue. The example you've provided has been very helpful. I've just updated Parker with support for media queries, and it should now measure rules correctly.

Total Stylesheets: 1
Total Stylesheet Size: 140096
Total Rules: 4100
Total Selectors: 4101
...
Total Important Keywords: 0
Total Media Queries: 2
Media Queries: screen,all