Skip to content

Commit

Permalink
allow storing of media queries in variables
Browse files Browse the repository at this point in the history
  • Loading branch information
geddski committed Aug 7, 2012
1 parent 6a55704 commit 7acf001
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/visitor/evaluator.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ Evaluator.prototype.visitReturn = function(ret){

Evaluator.prototype.visitMedia = function(media){
media.block = this.visit(media.block);
var query = this.lookup(media.val);
if(query) media.val = this.lookup("unquote").fn.call(this,query.nodes[0]);
return media;
};

Expand Down
5 changes: 5 additions & 0 deletions test/cases/queries.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@media screen and (min-width:1px) and (max-width:400px) {
body {
background: #00f;
}
}
4 changes: 4 additions & 0 deletions test/cases/queries.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
small = "screen and (min-width:1px) and (max-width:400px)"
@media small
body
background blue

0 comments on commit 7acf001

Please sign in to comment.