davestewart / nuxt-content-assets

Enable locally-located assets in Nuxt Content

Home Page:https://npmjs.com/package/nuxt-content-assets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

contentExtensions configuration not working properly

ayZagen opened this issue · comments

I would like to exclude mdx files from being detected as assets so I included following config as it defined in README:

contentAssets: {
  contentExtensions: 'md mdx yml yaml json',
}

however mdx files are still being treated as asset files and they are copied in public folder. I can also see those files in log output when debug: true is set.

I also tried using regex like configuration like this:

'mdx? ya?ml json'

but it didn't have any effect.

Am I missing something?

Hey @ayZagen - sorry I've too busy to look at any OSS for a while 😬

Are you still having problems with this?

hi there, yes this issue is still valid. i think contentExtensions configuration has no effect at all.

Sorry again for the delay @ayZagen.

I'm working on various tickets for Nuxt Content Assets right now.

Can I ask – if you're still using this package – did you load Nuxt Content Assets before Nuxt Content as per the docs?

export default defineNuxtConfig({
  modules: [
    'nuxt-content-assets', // make sure to add before content!
    '@nuxt/content',
  ]
})

If not, let me know and I'll attempt to debug this.

Yes, I strictly followed readme. I believe this function should be aware of contentExtensions config.

Thanks for coming back to me.

Let me take a look this afternoon and let you know.

Just to keep you updated, @ayZagen...

Struggling with getting #76 over the line with some weird side effects to nuxi prepare.

Severely limited on time this week, but this issue is next in line.

At least I'm reacquainted with the code, and fairly sure I know what I'm looking for and where to look for it.

In the meantime, can you see what happens when you set content's ignores config setting directly?

This should do as you ask, above:

export default defineNuxtConfig({
  content: {
    ignores: [
      '\\.(mdx?|ya?ml|json)$',
    ]
  }
})

Picked this up again today.

i think contentExtensions configuration has no effect at all.

So you're right – and there is a bug – but contentExtensions actually serves a different purpose (and is only included in the docs as an escape hatch in case the internal use of it doesn't do its job).

I'm solving the actual bug (files being copied) in two ways:

  1. clarifying the documentation around contentExtensions
  2. a fix, which prevents recognised content file types (md mdx csv yml yaml json) from being copied to public

Additionally, I'm adding an example to the playground.

Thanks for bringing this to my attention; the new fix will do what you need and I'll get it committed and pushed tonight!

Thanks a lot for your effort. I will try it as soon as possible.

Sorry it took so f---ing long 😆