ui icon indicating copy to clipboard operation
ui copied to clipboard

Missing native aspect ratio classes

Open heycesar opened this issue 3 years ago • 7 comments

Version

@nuxthq/ui: v2.7.0 nuxt: v3.6.5

Steps to reproduce

  1. Use aspect-square class in a component
  2. Compile Nuxt with nuxtlab/ui installed
  3. Check compiled website in browser, realize that aspect-square class is missing

What is Expected?

We expect use the native classes for aspect ratio over aspect ratio classes from original plugin or find a way to work with both flows properly

What is actually happening?

When we install nuxtlab/ui package we lost all classes working with the native aspect-ratio feature for version 3 of Tailwind,

We identified that nuxlabs/ui use the original package of aspect-ratio as plugin, so we think for that reason is a conflict with the classes

heycesar avatar Aug 23 '23 17:08 heycesar

Can you tell me if adding this in your tailwind.config.ts fixes the issue?

{
  theme: {
    extend: {
      aspectRatio: {
        auto: 'auto',
        square: '1 / 1',
        video: '16 / 9'
      }
    }
  }
}

benjamincanac avatar Aug 28 '23 09:08 benjamincanac

Hi @benjamincanac, that solves the main problem, but I need to do this in every new project?, I understand that new Aspect Ratio feature is part of the tailwind core and I don't need to do this configuration.

heycesar avatar Aug 28 '23 14:08 heycesar

I think it's better to keep using the plugin instead of the native core one for now from what I understand from this section: https://github.com/tailwindlabs/tailwindcss-aspect-ratio#compatibility-with-default-aspect-ratio-utilities

benjamincanac avatar Aug 28 '23 14:08 benjamincanac

Hi @benjamincanac I got it, thanks for your time!

heycesar avatar Aug 28 '23 16:08 heycesar

Can we write about this somewhere in the docs? I was so confused because these values did not work @benjamincanac

metkm avatar Nov 25 '23 16:11 metkm

I'm not sure that "Safari 14 still has significant global usage" still applies. Today it looks to be barely over 1% combined desktop and mobile. Screenshots from caniuse:

https://caniuse.com/mdn-css_properties_aspect-ratio

Screenshot 2024-01-04 at 10 26 56 AM Screenshot 2024-01-04 at 10 27 03 AM

andrew-boyd avatar Jan 04 '24 15:01 andrew-boyd

as a stop-gap solution I'm going to update our themes to use the aspect-[1/1] syntax rather than aspect-square since that will allow us to achieve compatibility with Nuxt UI without requiring users to install a plugin or update their TW config files.

andrew-boyd avatar Jan 04 '24 15:01 andrew-boyd