Skip to content

Commit

Permalink
Fixed missing a new line after a custom @-rule
Browse files Browse the repository at this point in the history
See #60
  • Loading branch information
Anantachai Saothong (Manta) committed May 6, 2020
1 parent 995d84d commit 86c90dc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion edge/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ function format(content, options = {}) {

} else if (inputNode instanceof Stylus.nodes.Atrule) {
outputBuffer.append(indent + '@' + inputNode.type)
if (_.some(inputNode.segments)) {
if (inputNode.segments.length > 0) {
outputBuffer.append(' ')
outputBuffer.append(travelThroughSegments(inputNode, indentLevel).join(''))
outputBuffer.remove(' ')
Expand All @@ -1045,6 +1045,7 @@ function format(content, options = {}) {
outputBuffer.append(travel(inputNode, inputNode.block, indentLevel))
} else if (options.insertSemicolons) {
outputBuffer.append(';')
outputBuffer.append(options.newLineChar)
}

} else if (inputNode instanceof Stylus.nodes.Atblock) {
Expand Down
5 changes: 4 additions & 1 deletion spec/rule/input.styl
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ body
border-color @css { ${$design.primaryLight} }
{type}-{direction} none

@reset-global pc
@reset-global pc

@custom gutter 24px
@custom flexbox flex
4 changes: 3 additions & 1 deletion spec/rule/output.styl
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ body {
}
}

@reset-global pc;
@reset-global pc;
@custom gutter 24px;
@custom flexbox flex;

0 comments on commit 86c90dc

Please sign in to comment.