prettier icon indicating copy to clipboard operation
prettier copied to clipboard

Regnize `<ratio>` CSS value

Open fisker opened this issue 2 years ago • 2 comments

Prettier 3.0.2 Playground link

--parser css

Input:

div {
  aspect-ratio: 16 / 9; 
  aspect-ratio: 16/ 9; 
  aspect-ratio: 16 /9; 
}

Output:

div {
  aspect-ratio: 16 / 9;
  aspect-ratio: 16/ 9;
  aspect-ratio: 16 /9;
}

Expected behavior:

They should format the same, properly

div {
  aspect-ratio: 16 / 9;
  aspect-ratio: 16 / 9;
  aspect-ratio: 16 / 9;
}

The <ratio> CSS data type

fisker avatar Sep 01 '23 03:09 fisker

Just from my experience - most of developer prefer no spaces in ratio

alexander-akait avatar Jan 11 '24 13:01 alexander-akait

@alexander-akait

Personally, I use space around /.

I did a search

  • With space
  • Without space

~It seems the space version is more popular?~ Update: No space version has more results.

fisker avatar Jan 23 '24 11:01 fisker