Repository navigation
Closed
Labels
locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.
Description
I ran Prettier on some real word SCSS code and went through the diff. I found a few things that didn't print super nice, and a few things that broke the code.
Missing space to the right of /
.Image {
@media (max-width: $image-width-responsive) {
padding-bottom:
(
100% *
$image-height /
($image-width-responsive + $image-margin-responsive * 2)
);
}
}.Image {
@media (max-width: $image-width-responsive) {
padding-bottom: (
100% *
$image-height /($image-width-responsive + $image-margin-responsive * 2)
);
}
}Also, printing it more like we do for JS would be nicer:
if (1) {
if (1) {
padding_bottom = (
100 *
$image_height /($image_width_responsive + $image_margin_responsive * 2)
);
}
}if (1) {
if (1) {
padding_bottom =
100 *
$image_height /
($image_width_responsive + $image_margin_responsive * 2);
}
}Another example:
a {
padding-right: (100% * $info-width / (1 - $image-width));
}a {
padding-right: (100% * $info-width /(1 - $image-width));
}Extraneous space before > at BOL
a {
> * {
}
}a {
> * {
}
}Also happens for + and ~.
Hmm, not only beginning of lines, but also beginning of sub selector:
a {
&,
> span[data-i18n] {
}
}a {
&, > span[data-i18n] {
}
}This would be nicer if printed more like JS
a {
b {
img {
max-height:
calc(
100vh -
#{var(--margin)} * 2 - #{var(--padding)} * 2 -
#{$extra-space-for-scrollbar}
);
}
}
}a {
b {
img {
max-height: calc(
100vh -
#{var(--margin)} *
2 -
#{var(--padding)} *
2 -
#{$extra-space-for-scrollbar}
);
}
}
}{
{
max_height = calc(
100 -
$(car(__margin)) *
2 -
$(car(__padding)) *
2 -
$($extra_space_for_scrollbar)
);
}
}{
{
max_height = calc(
100 -
$(car(__margin)) * 2 -
$(car(__padding)) * 2 -
$($extra_space_for_scrollbar)
);
}
}Should we try to break here?
Garbage in, garbage out, or do we want to break something like the input here?
a {
~ .Pagination-itemWrapper:not(.is-separator):not([data-priority^='#{$priority}'])
~ .Pagination-itemWrapper.is-separator[data-priority^='#{$priority}'] {
display: flex;
}
}a {
~ .Pagination-itemWrapper:not(.is-separator):not([data-priority^='#{$priority}']) ~ .Pagination-itemWrapper.is-separator[data-priority^='#{$priority}'] {
display: flex;
}
}Removed space before -
a {
width: calc(100% - (#{var(--g-spacing)} - #{$iframe-x-padding}) * 2);
}a {
width: calc(100% -(#{var(--g-spacing)} - #{$iframe-x-padding}) * 2);
}Reacted by Christopher Chedeau
Metadata
Metadata
Assignees
Labels
locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.
Activity
vjeux commentedon May 29, 2017
Right now we only get a stream of tokens. We'd need to parse it to be able to reprint it properly. If you are interested in writing a small arithmetic parser, that would be great :)
vjeux commentedon May 29, 2017
#1806 and #1807 fix a bunch of your issues.
I'm going to try and break expressions before combinators now.
vjeux commentedon May 29, 2017
Okay, #1809 adds the ability for ultra long selectors to break before combinators. So everything here is done.
The only remaining thing is to handle arithmetic operators better. For this, we need to implement a small arithmetic parser and print it correctly. It shouldn't be too hard, but I'm going to focus on other things to get a release going.
lydell commentedon May 29, 2017
Awesome! You decide if we should keep this issue open or not :)
vjeux commentedon May 29, 2017
Could you open a separate issue for improving printing of arithmetic?
lydell commentedon May 29, 2017
Ok! #1811