HTML not dynamically reloading in Svelte
So I have this function that fetches a bunch of images from my firebase and stores everything in a writable array called attributeList async function loadPokemon(generation:number){ // Create a...
View ArticleFacial Recognition in the browser using face-api.js not working
I am trying to make a facial recognition system in the browser using face-api.js in a svelte project. the problem is that it recognizer saved faces but only one face will be recognized. for example if...
View ArticleHow can I use a component as a variable when using Svelte and Carbon Components?
When using Carbon Component for Svelte, is it possible to assign a component as a variable, and then pass that variable to a prop?For example, I'm using the <Modal /> component, whose primary...
View ArticleHow do you load and use a custom font in Svelte
I know it probably uses @font-face but I dont know where to put my woff files localy to get Svelte to use a custom font. I dont know where to put the @font-face either. Thanks in advance!
View ArticleBinding elements in conditional block
The conventional way to reference an HTML element is Svelte is to introduce a variable and bind:this the element to the variable. Like this<script> let divName;</script><div...
View ArticleConsume REST API and use response data inside multiple components (Not page)
I have a page with multiple components, like tables and displayed in one page.My +page.svelte:<script>..<script><div class="page-content"><Row><Table1 /><List />...
View ArticleReusing nested subroutes in Sveltekit
On sveltekit is there a way to reuse a set of nested subroutes on several higher-level routes without repeating code?Use caseI have a website about sports, I have the following routes:/dailies --> 2...
View ArticleHow to disable Svelte warning "Unused CSS selector"
The approach of my graphic designer for formatting our Svelte application is having a systematic set of classes in LESS, importing the appropriate LESS file in the component or page, and then applying...
View ArticleCan I keep "unused css selector"?
I noticed that svelte will purge my css automatically, all "unused css selector" will get removed.For example:<p class="blue">This is a paragraph.</p><style> .red{ color: red; }...
View ArticleRaise/handle event from/of dynamic component
I'm currently facing the following problem.I have a ComponentA which renders dynamic components of unknown type (ComponentA gets these components to render via its props - importin these component...
View ArticleHow to redirect to page in SvelteKit?
I have a page with content rendered from a SvelteKit store. If the store is invalid, a user needs do be redirected to the homepage. Unfortunately, I can't find a way to redirect a user even without...
View ArticleLinting for Pug and SASS inside Svelte files
My current setup is SvelteKit with preprocessors (TypeScript, Pug & SASS). I already have eslint, pug-lint & stylelint in place, but I can't make pug-lint and stylelint work inside .svelte...
View ArticleUsing SlickGrid (v5.x) with Svelte (or Sveltekit)
I was wondering if anybody has managed to integrate SlickGrid (the latest Typescript version) with Svelte? I can see that people are using it with React and Angular, but can find no info on Svelte. I...
View ArticleHow to access cookies within +layout.js in SvelteKit?
I want to access cookies in the load function within +layout.js. I want to be able to make my header/nav in the template show "login/signup" in the nav if there is not a jwt saved in cookies, but show...
View ArticleHow to catch error if .env file not found in Svelte?
Let's say I import an .env variable usingimport { PUBLIC_URL } from '$env/static/public';If the variable does not exists, it will throw an HTTP 500 Internal Server error and I can read the error in the...
View ArticleMeshPhongMaterial not working with Threlte
I'm trying to use ThreeJS with Svelte ("Threlte"). My goal is to reproduce the Earth from an IcosahedronGeometry. To do this, I want a MeshPhongMaterial for the Earth's mesh.Here is my app's entrypoint...
View ArticleVariable is possibly undefined with Svelte "bind:this={}"
When I try to use Svelte's bind:this attribute, I get this shown in vscode:'cardGroup' is possibly 'undefined'.js(18048)And when run, I get this error:TypeError: Cannot read properties of undefined...
View ArticleHow do I preserve state when hot reloading in a standard SvelteKit dev...
I have a pretty standard out of the box Svelte dev environment setup based on these docs in early 2024.My vite.config.js file currently looks like this:import { sveltekit } from...
View ArticleDetect url params changes in sveltekit 2
I've been searching for quite long and I haven't found a solution yet.I have a restaurant (menu/foods) CRUD app, where the "foods" section in the menu is the most important one. Inside the "foods" page...
View ArticleHow to Fix Error Svelte Inertia Laravel NS_ERROR_ILLEGAL_VALUE in Firefox
I used inertia with svelte to build my website, but in Firefox browser there is have and problem like this :
View Article