Skip to content

Commit

Permalink
Fixed using @media with a hash
Browse files Browse the repository at this point in the history
See #18
  • Loading branch information
ThisIsManta committed Jan 18, 2018
1 parent d2fea76 commit d12287c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
15 changes: 10 additions & 5 deletions edge/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -915,11 +915,16 @@ function format(content, options = {}) {
}

} else if (inputNode instanceof Stylus.nodes.Feature) {
outputBuffer.append(openParen)
outputBuffer.append(travelThroughSegments(inputNode, indentLevel).join(''))
outputBuffer.append(': ')
outputBuffer.append(travel(inputNode, inputNode.expr, indentLevel, true))
outputBuffer.append(closeParen)
if (inputNode.expr) {
outputBuffer.append(openParen)
outputBuffer.append(travelThroughSegments(inputNode, indentLevel).join(''))
outputBuffer.append(': ')
outputBuffer.append(travel(inputNode, inputNode.expr, indentLevel, true))
outputBuffer.append(closeParen)

} else {
outputBuffer.append(travel(inputNode, inputNode.segments[0], indentLevel, true))
}

} else if (inputNode instanceof Stylus.nodes.Supports) {
outputBuffer.append(indent + '@supports ')
Expand Down
9 changes: 8 additions & 1 deletion spec/media/input.styl
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,11 @@
display none
@media only screen and (min-width: 0px) and (max-width: 679px)
display none


$display-breakpoints = {
md-and-up: 'screen and (min-width: 600px)'
}

@media $display-breakpoints.md-and-up
.widget
display: none
10 changes: 10 additions & 0 deletions spec/media/output.styl
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,13 @@
@media only screen and (min-width: 0px) and (max-width: 679px) {
display: none;
}

$display-breakpoints = {
md-and-up: 'screen and (min-width: 600px)'
};

@media $display-breakpoints.md-and-up {
.widget {
display: none;
}
}

0 comments on commit d12287c

Please sign in to comment.