Skip to content

Commit

Permalink
Merge pull request stylus#776 from geddesign/master
Browse files Browse the repository at this point in the history
enable storing of media queries in variables
  • Loading branch information
tj committed Aug 7, 2012
2 parents 3f055e1 + 4377ce6 commit f61e61a
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 = new nodes.Literal(query.nodes[0].string);
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 f61e61a

Please sign in to comment.