diff --git a/public/images/ember.svg b/app/assets/images/ember.svg similarity index 100% rename from public/images/ember.svg rename to app/assets/images/ember.svg diff --git a/public/images/embroider.svg b/app/assets/images/embroider.svg similarity index 100% rename from public/images/embroider.svg rename to app/assets/images/embroider.svg diff --git a/public/images/glimmer-ts.svg b/app/assets/images/glimmer-ts.svg similarity index 100% rename from public/images/glimmer-ts.svg rename to app/assets/images/glimmer-ts.svg diff --git a/public/images/glint.png b/app/assets/images/glint.png similarity index 100% rename from public/images/glint.png rename to app/assets/images/glint.png diff --git a/public/images/tailwind.svg b/app/assets/images/tailwind.svg similarity index 100% rename from public/images/tailwind.svg rename to app/assets/images/tailwind.svg diff --git a/public/images/typescript.svg b/app/assets/images/typescript.svg similarity index 100% rename from public/images/typescript.svg rename to app/assets/images/typescript.svg diff --git a/public/images/vite.svg b/app/assets/images/vite.svg similarity index 100% rename from public/images/vite.svg rename to app/assets/images/vite.svg diff --git a/public/images/volar.svg b/app/assets/images/volar.svg similarity index 100% rename from public/images/volar.svg rename to app/assets/images/volar.svg diff --git a/public/images/warp-drive.svg b/app/assets/images/warp-drive.svg similarity index 100% rename from public/images/warp-drive.svg rename to app/assets/images/warp-drive.svg diff --git a/app/helpers/import-asset.ts b/app/helpers/import-asset.ts new file mode 100644 index 0000000..3c284c2 --- /dev/null +++ b/app/helpers/import-asset.ts @@ -0,0 +1,10 @@ +const images = import.meta.glob('../assets/images/*.(svg|png)', { + eager: true, +}); + +export default function importAsset(assetName: string): string { + const imagePath = images[`../assets/images/${assetName}`] as + | { default: string } + | undefined; + return imagePath?.default ?? ''; +} diff --git a/app/templates/about.gts b/app/templates/about.gts index 3a8d911..f89b71a 100644 --- a/app/templates/about.gts +++ b/app/templates/about.gts @@ -3,6 +3,8 @@ import { RouteTemplate } from 'ember-polaris-pokedex/utils/ember-route-template' import Component from '@glimmer/component'; import HomeButton from 'ember-polaris-pokedex/components/home-button'; +import importAsset from 'ember-polaris-pokedex/helpers/import-asset'; + @RouteTemplate export default class ApplicationTemplate extends Component {