build(#46): Use .env var for image base path

This commit is contained in:
Josh Creek
2024-07-17 17:49:19 +01:00
parent 8b32bca11c
commit c071dca26a
+7 -5
View File
@@ -1,6 +1,7 @@
<script lang="ts"> <script lang="ts">
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import pokeApiPokemon from '$lib/helpers/pokeapi-pokemon.json'; import pokeApiPokemon from '$lib/helpers/pokeapi-pokemon.json';
import { PUBLIC_USE_LOCAL_POKEMON_SPRITE_FOLDER } from '$env/static/public';
export let pokemonName: string; export let pokemonName: string;
export let pokedexNumber: string | number; export let pokedexNumber: string | number;
@@ -12,8 +13,9 @@
function setImagePath() { function setImagePath() {
let rootFolder = let rootFolder =
'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/home'; PUBLIC_USE_LOCAL_POKEMON_SPRITE_FOLDER === 'true'
// let rootFolder = 'sprites/home'; ? '/sprites/home'
: 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/home';
if (form === 'Female') { if (form === 'Female') {
rootFolder += '/female'; rootFolder += '/female';
@@ -57,9 +59,9 @@
break; break;
} }
if (strippedPokedexNumber == '869') { // if (strippedPokedexNumber == '869') {
console.log(sanitisedPokemonName, sanitisedForm); // console.log(sanitisedPokemonName, sanitisedForm);
} // }
// If the form is contained in the identifier, use that // If the form is contained in the identifier, use that
if ( if (