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

Better targeting in markup for path transformation

davestewart opened this issue · comments

Background

Right now, supported tags and attributes are internally configured.

This means that whilst an <img src=""> will have its src transformed, <CustomImage image="" /> will not.

Proposal

Some way to configure per asset or per attribute what to transform, for example, default config:

{
  attrsMap: {
    'a': 'href',
    '*': 'src',
    'CustomImage': 'image',
  }
}

This would target:

  • anchor tags
  • anything with a src attribute
  • CustomImage component's image attribute

Maybe even:

{
  attrsMap: {
    '*': 'href src',
    'CustomImage': 'image',
  }
}

Or maybe even simply test visited nodes to be elements, then test any string prop against the hash of paths 👍

Closed by #11