From the course: Learning Nuxt.js

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Solution: Optimizing images using the Nuxt Image module

Solution: Optimizing images using the Nuxt Image module

From the course: Learning Nuxt.js

Solution: Optimizing images using the Nuxt Image module

(upbeat music) - Welcome back. How did it go? Let me show you how I solved this challenge. Heading over to the co-editor. First thing we'd like to do here is install the Nuxt image module. And to do that, I'll run the command in my terminal MPM install at Nuxt image. While it's being installed I would open up the Nuxt config file and in the modules property online 40 I'll add a new module there. So right here, I'm registering the Nuxt image module so that I can use it in my application. Great. Now that we've done that, another thing you need to know is that with Nuxt it's only optimizes images that are by default present in the locals directory. So if you have like an image in the static file or the assets directory, it's going to optimize that. But if you're fetching data from like an external API and the domain for the image is different, you would also need to include an image configuration for that.…

Contents