fix calc whitespace (#71)
This commit is contained in:
parent
45ad97e0be
commit
1e440a0d2c
@ -5,7 +5,7 @@ use codemap::{CodeMap, Span};
|
|||||||
use crate::{
|
use crate::{
|
||||||
ast::{CssStmt, MediaQuery, Style, SupportsRule},
|
ast::{CssStmt, MediaQuery, Style, SupportsRule},
|
||||||
color::{Color, ColorFormat, NAMED_COLORS},
|
color::{Color, ColorFormat, NAMED_COLORS},
|
||||||
common::{Brackets, ListSeparator, QuoteKind},
|
common::{BinaryOp, Brackets, ListSeparator, QuoteKind},
|
||||||
error::SassResult,
|
error::SassResult,
|
||||||
selector::{
|
selector::{
|
||||||
Combinator, ComplexSelector, ComplexSelectorComponent, CompoundSelector, Namespace, Pseudo,
|
Combinator, ComplexSelector, ComplexSelectorComponent, CompoundSelector, Namespace, Pseudo,
|
||||||
@ -358,7 +358,8 @@ impl<'a> Serializer<'a> {
|
|||||||
self.buffer.push(b')');
|
self.buffer.push(b')');
|
||||||
}
|
}
|
||||||
|
|
||||||
let operator_whitespace = !self.options.is_compressed() || op.precedence() == 1;
|
let operator_whitespace =
|
||||||
|
!self.options.is_compressed() || matches!(op, BinaryOp::Plus | BinaryOp::Minus);
|
||||||
|
|
||||||
if operator_whitespace {
|
if operator_whitespace {
|
||||||
self.buffer.push(b' ');
|
self.buffer.push(b' ');
|
||||||
|
@ -146,3 +146,9 @@ test!(
|
|||||||
"a{color:a/b/c}",
|
"a{color:a/b/c}",
|
||||||
grass::Options::default().style(grass::OutputStyle::Compressed)
|
grass::Options::default().style(grass::OutputStyle::Compressed)
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
calc,
|
||||||
|
"a {\n width: calc(100% + 32px);\n}\n",
|
||||||
|
"a{width:calc(100% + 32px)}",
|
||||||
|
grass::Options::default().style(grass::OutputStyle::Compressed)
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user