davestewart / nuxt-content-assets

Enable locally-located assets in Nuxt Content
https://npmjs.com/package/nuxt-content-assets
108 stars 7 forks source link

Can we use NuxtImg as suggested, but also keep the ability to use NuxtImg with the original assets folder, elsewhere? #61

Closed Tmp2k closed 2 months ago

Tmp2k commented 6 months ago

Background

Maybe what I'm asking for isn't the right way to go about it but here's what I wanted to do...

Existing Nuxt pages with hard-coded images, components etc that use NuxtImg. Like the home page or header/footer. Then you have a news section that uses YML content and media/assets.

I want to keep the rest of the assets and code in the repo, but the /content/ folder containing YML and media can be updated separately. Also the content is HTML inside YML, not MD. (there's other reasons for this)

I want to be able to add a YML file with either an , or and use a relative path and have content-assets work as intended. Served via NuxtImg with all the SEO and pre-processing fanciness.

If I follow the docs I can do this, but I have to change the dir config for NuxtImg to use the content-assets output folder and this stops the rest of the templates and NuxtImgs from working.

Issue

Is there a way to have content-assets output to the regular assets/images folder, or a way to have NuxtImg server assets from both folders? Or a way I can make this work, perhaps with a custom component?

davestewart commented 2 months ago

Hi Steven,

So sorry - I've been ignoring my OSS commitments for some time!

I'm not sure if I completely follow what you want to do, but I suspect the solution might be for Nuxt Content Assets to use a custom Nuxt Image provider:

I haven't looked into this yet, but hoping it will be the right solution. Do you think this might help you get what you want?

I need to look into Nuxt Image again anyway, as NCA it doesn't seem to be working with the new NI version anyway 😬

davestewart commented 2 months ago

Hey @Tmp2k - this issue was fixed in 1.4.0 but appears to be problematic for nuxi generate.

It is about to be vanquished once and for all by #76, though I'm having a few problems getting it over the line due to some strange side effects in nuxi generate.

Will update in due course!

davestewart commented 2 months ago

Just to let you know @Tmp2k – v1.4.3 is out now, with a slightly-tweaked config, but it now correctly renders Nuxt Images in SSG mode.

Do let me know if you have any problems, as I'll be keen to fix them as soon as possible 👍

Tmp2k commented 2 months ago

Amazing, I've been following the updates, thanks for this! I've been really busy with other projects recently but I'm excited to pick this back up again.

I'll let you know how I get on.

davestewart commented 2 months ago

I know how that is!

It would be great to get some assurance it's gone ok, but I get it 😅