nextjs-image

How to use Tailwind CSS with Next.js Image

余生颓废 提交于 2021-02-20 19:15:45
问题 I am trying to use Tailwind CSS in an Next.js project but I cant't use my Tailwind classes with Next.js Image component. Here's my code: <Image src={img.img} alt="Picture of the author" width="200" height="200" className="bg-mint text-mint fill-current" ></Image> I want to use Tailwind classes instead of the height and width property of the Next.js Image. But I can't because it throws me an error. Also, unsized property throws another error saying it's deprecated. Is there any solution? Here

How to cache NextJS 10.0 images using NGINX

时光总嘲笑我的痴心妄想 提交于 2021-02-11 14:17:58
问题 We would like to launch a NextJS 10 app using NGINX so we use a configuration similar to: location /_next/static/ { alias /home/ec2-user/my-app/.next/static/; expires 1y; access_log on; } It works great, it caches for a year our statics but as we use NextJS images I'm failing to add an expires tag on on-the-fly resized images. If I do: location /_next/image/ { alias /home/ec2-user/my-app/.next/image; expires 1y; access_log on; } It just returns a 404 on images. Here is my server part NGINX