Format SCSS maps like CSS rules (#3070)
* Format SCSS maps like CSS rules * Ensure parent value starts with $ before formatting map with hardlinesmaster
parent
b53a426e15
commit
c6d97abf95
|
@ -339,13 +339,22 @@ function genericPrint(path, options, print) {
|
||||||
return group(indent(fill(res)));
|
return group(indent(fill(res)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const declaration = path.getParentNode(2);
|
||||||
|
const isMap =
|
||||||
|
declaration &&
|
||||||
|
declaration.type === "css-decl" &&
|
||||||
|
declaration.prop.startsWith("$");
|
||||||
|
|
||||||
return group(
|
return group(
|
||||||
concat([
|
concat([
|
||||||
n.open ? path.call(print, "open") : "",
|
n.open ? path.call(print, "open") : "",
|
||||||
indent(
|
indent(
|
||||||
concat([
|
concat([
|
||||||
softline,
|
softline,
|
||||||
join(concat([",", line]), path.map(print, "groups"))
|
join(
|
||||||
|
concat([",", isMap ? hardline : line]),
|
||||||
|
path.map(print, "groups")
|
||||||
|
)
|
||||||
])
|
])
|
||||||
),
|
),
|
||||||
softline,
|
softline,
|
||||||
|
|
|
@ -18,6 +18,7 @@ div {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
a { margin: 0 { left: 10px; } }
|
a { margin: 0 { left: 10px; } }
|
||||||
|
$map: (color: #111111, text-shadow: 1px 1px 0 salmon);
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@media #{$g-breakpoint-tiny} {
|
@media #{$g-breakpoint-tiny} {
|
||||||
}
|
}
|
||||||
|
@ -38,5 +39,9 @@ a {
|
||||||
left: 10px;
|
left: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$map: (
|
||||||
|
color: #111111,
|
||||||
|
text-shadow: 1px 1px 0 salmon
|
||||||
|
);
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -8,3 +8,4 @@ div {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
a { margin: 0 { left: 10px; } }
|
a { margin: 0 { left: 10px; } }
|
||||||
|
$map: (color: #111111, text-shadow: 1px 1px 0 salmon);
|
||||||
|
|
Loading…
Reference in New Issue