Repository: tailwindlabs/tailwindcss
File: packages/tailwindcss/src/utilities.ts (TypeScript)

Code before:
    let forMax = key !== 'auto'

    if (forHeight && forWidth) {
      staticUtility(`size-${key}`, [
        ['--tw-sort', 'size'],
        ['width', value],
        ['height', value],
      ])
    }

    if (forWidth) {
      staticUtility(`w-${key}`, [['width', value]])
      staticUtility(`min-w-${key}`, [['min-width', value]])

      if (forMax) {
        staticUtility(`max-w-${key}`, [['max-width', value]])
      }
    }

    if (forHeight) {
      staticUtility(`h-${key}`, [['height', value]])
      staticUtility(`min-h-${key}`, [['min-height', value]])

      if (forMax) {
        staticUtility(`max-h-${key}`, [['max-height', value]])
      }
    }
  }

  staticUtility(`w-screen`, [['width', '100vw']])
  staticUtility(`min-w-screen`, [['min-width', '100vw']])
  staticUtility(`max-w-screen`, [['max-width', '100vw']])
  staticUtility(`h-screen`, [['height', '100vh']])
  staticUtility(`min-h-screen`, [['min-height', '100vh']])
  staticUtility(`max-h-screen`, [['max-height', '100vh']])

  staticUtility(`max-w-none`, [['max-width', 'none']])
  staticUtility(`max-h-none`, [['max-height', 'none']])

  spacingUtility(
    'size',
    ['--size', '--spacing'],
    (value) => [decl('--tw-sort', 'size'), decl('width', value), decl('height', value)],
    {
      supportsFractions: true,
    },
  )

  for (let [name, namespaces, property] of [
    ['w', ['--width', '--spacing', '--container'], 'width'],
    ['min-w', ['--min-width', '--spacing', '--container'], 'min-width'],

Review comment (suggestion):
I think it might be nicer to just store the common stuff in a variable and `concat` the extra stuff for the utilities that use them. Means a couple of loops instead of one but I think the simplicity/clarity of the code would be worth it.

Code after:
    ])
    staticUtility(`w-${key}`, [['width', value]])
    staticUtility(`h-${key}`, [['height', value]])
    staticUtility(`min-w-${key}`, [['min-width', value]])
    staticUtility(`min-h-${key}`, [['min-height', value]])
    staticUtility(`max-w-${key}`, [['max-width', value]])
    staticUtility(`max-h-${key}`, [['max-height', value]])
  }

  staticUtility(`size-auto`, [
    ['--tw-sort', 'size'],
    ['width', 'auto'],
    ['height', 'auto'],
  ])
  staticUtility(`w-auto`, [['width', 'auto']])
  staticUtility(`h-auto`, [['height', 'auto']])
  staticUtility(`min-w-auto`, [['min-width', 'auto']])
  staticUtility(`min-h-auto`, [['min-height', 'auto']])

  staticUtility(`h-lh`, [['height', '1lh']])
  staticUtility(`min-h-lh`, [['min-height', '1lh']])
  staticUtility(`max-h-lh`, [['max-height', '1lh']])

  staticUtility(`w-screen`, [['width', '100vw']])
  staticUtility(`min-w-screen`, [['min-width', '100vw']])
  staticUtility(`max-w-screen`, [['max-width', '100vw']])
  staticUtility(`h-screen`, [['height', '100vh']])
  staticUtility(`min-h-screen`, [['min-height', '100vh']])
  staticUtility(`max-h-screen`, [['max-height', '100vh']])

  staticUtility(`max-w-none`, [['max-width', 'none']])
  staticUtility(`max-h-none`, [['max-height', 'none']])

  spacingUtility(
    'size',
    ['--size', '--spacing'],
    (value) => [decl('--tw-sort', 'size'), decl('width', value), decl('height', value)],
    {
      supportsFractions: true,
    },
  )

  for (let [name, namespaces, property] of [
    ['w', ['--width', '--spacing', '--container'], 'width'],
    ['min-w', ['--min-width', '--spacing', '--container'], 'min-width'],
    ['max-w', ['--max-width', '--spacing', '--container'], 'max-width'],
    ['h', ['--height', '--spacing'], 'height'],
    ['min-h', ['--min-height', '--height', '--spacing'], 'min-height'],
    ['max-h', ['--max-height', '--height', '--spacing'], 'max-height'],
  ] as [string, ThemeKey[], string][]) {
    spacingUtility(name, namespaces, (value) => [decl(property, value)], {