Aller au contenu principal

new URL() assets tests

Assets can be referenced inline with the standard new URL('./path', import.meta.url) syntax.

It should return the asset URL, including on the server (SSR): the IdealImage and SVGR plugins must not transform those assets.

JSX​

  • Small image (inlined as data URL): Open source logo
  • Large image (emitted as file): Docusaurus social card
  • Large image with the @site alias: Docusaurus social card
  • SVG image (not transformed into a React component): Docusaurus mascot
  • PDF file link

MDX​

  • Small image: Open source logo
  • Large image: Docusaurus social card
  • Large image with the @site alias: Docusaurus social card
  • SVG image: Docusaurus mascot
  • PDF file link