zmoazeni / csscss

A CSS redundancy analyzer that analyzes redundancy.
http://zmoazeni.github.io/csscss/
MIT License
2.92k stars 151 forks source link

Don't know what to do with "@media" #73

Closed verpixelt closed 11 years ago

verpixelt commented 11 years ago

I got the following parsing error "Don't know what to do with "@media"". Any idea for that?

zmoazeni commented 11 years ago

@verpixelt Can you provide a small css snippet that this fails with?

verpixelt commented 11 years ago
@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/kevinlorenz\/Desktop\/Source-Maps-101\/start\/styles\/style\.sass}line{font-family:\000034}}
body {
  background-color: #d9d9d9; }

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/kevinlorenz\/Desktop\/Source-Maps-101\/start\/styles\/style\.sass}line{font-family:\000037}}
input {
  background-color: rgba(255, 255, 255, 0.5);
  border: 0;
  display: block;
  font-size: 3em;
  margin: 15% auto;
  outline: none;
  padding: 0.4em;
  width: 20%; }

@media only screen and (max-width: 600px) {
@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/kevinlorenz\/Desktop\/Source-Maps-101\/start\/styles\/style\.sass}line{font-family:\0000318}}
  input {
    font-size: 2em;
    width: 40%; } }
zmoazeni commented 11 years ago

This is probably choking on the nested media query. Which looks like is a new CSS3 addition.

mrjxn commented 11 years ago

Can't run tool on Foundation based css (foundation.zurb.com) due to this bug - any chance of a fix? Seems to get through the first lot of @media but stops at this: (LINE# matches the first line of the media query:

=> csscss -v --show-parser-errors app_1.css Had a problem parsing the css at line: 4225, column: 1 Failed to match sequence (SPACE? blocks:((COMMENT / IMPORT / NESTED_RULESET / RULESET){1, }) SPACE?) at line 4225 char 1. `- Don't know what to do with "@media onl" at line 4225 char 1.

/* Foundation Switches */ @media only screen { .... ... (one nested portion at the end of query)... ... @-webkit-keyframes webkitSiblingBugfix { from { position: relative; } to { position: relative; } } }

zmoazeni commented 11 years ago

Ok, this is fixed in master. I'll release a version soon. It will go out in the version following v1.3.1.