Prettier: css @media tag formatting doesn't respect line length

Created on 19 Jun 2017  Â·  1Comment  Â·  Source: prettier/prettier

When prettifying css, @media tags aren't broken up in a way that respects the max line length e.g.
I had the following

@media
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (   min--moz-device-pixel-ratio: 2),
only screen and (     -o-min-device-pixel-ratio: 2/1),
only screen and (        min-device-pixel-ratio: 2),
only screen and (                min-resolution: 192dpi),
only screen and (                min-resolution: 2dppx) {

Which was reformatted to

@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (-webkit-min-dev
ice-pixel-ratio: 1.5), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-
min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (m
in-resolution: 192dpi), only screen and (min-resolution: 2dppx) {

Despite this exceeding the max line length. My expectation was that the nearest comma separated section of the media declaration would be split onto a new line in the same way as css selectors.

help wanted csscsless locked-due-to-inactivity bug

Most helpful comment

Thanks for the repro, it indeed should break it into multiple lines.

It's not going to keep the whitespaces to align things though.

>All comments

Thanks for the repro, it indeed should break it into multiple lines.

It's not going to keep the whitespaces to align things though.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nfriedly picture nfriedly  Â·  3Comments

jasonkuhrt picture jasonkuhrt  Â·  3Comments

poteto picture poteto  Â·  3Comments

dmnd picture dmnd  Â·  3Comments

jitendravyas picture jitendravyas  Â·  3Comments