Category "svelte"

Testing Svelte components with dynamically imported components in jest (await import)

I'm writing a test in jest for a svelte component which dynamically imports another component. The following snippet is the part where the dynamic import happen

How to route programmatically in SvelteKit?

I want to be able manage history of my SvelteKit app while simultaneously making sure the whole routing system of SvelteKit doesn't get affected in any way. Som

can I change Svelte delimiter?

I am working on a big project that use Smarty template engine with AngularJs and we need to move out from AngularJs to Svelte. we face a bad problem that the de

Is it possible in Svelte to have #each loops with two-way binding to nested object values?

The following Svelte code works fine: <input bind:value='options.name.value' placeholder='{{options.name.placeholder}}'> <p>Hello {{options.name.va

Svelte - is there a way to use JS inside #each?

I'm iterating over an array of data and I want to do some processing on it before rendering it. I know that I could create a new component and pass array entry

Use postcss-normalize with Svelte

I didn't manage to import postcss-normalize to Svelte using official starting boileprlate and svelte-preprocess. My rollup config: … plugins: [ svelte(

How to write a "Delayed" svelte component?

I'm trying to write a Svelte component that hides its slot during the time specified. For example, this next line should hide the paragraph during 3 seconds <

Sveltekit Greensock Scrolltrigger breaking in production

I have a Green Sock animation that is working fine in development, but breaks in yarn run preview and production: ScrollTrigger-4a410f45.js:9 Uncaught (in promi

How to use Svelte store with tree-like nested object?

The Svelte official tutorial employs such complex object in its document for <svelte:self> let root = [ { type: 'folder', name: 'Impor

Which is the best/most idiomatic way to communicate with components in Svelte?

I am trying to understand how to communicate with Svelte components. In my app I have created two components. In one, Antescript.svelte, I communicate with App.

Is there a way to run prisma in the sveltekit load function?

I have a sveltekit app I'm working on and it includes Prisma, I have been trying to pass a posts Array to all of my routes via the __layout's load function. Thi

Svelte how to import

I am working on my first svelte project and are trying to use google-api-wrapper with the only change being that i import: import Google from "google-api-wrappe

How to use an external backend with SvelteKit

I want to use SvelteKit with an external backend. Let's consider the backend is not in NodeJS, already done and running and that every bit of non-static data co

How to fetch data from endpoint in Sveltekit version v1.0.0-next.287

Yesterday I updated SvelteKit version from v1.0.0-next.241 to v1.0.0-next.287, and since I cannot fetch data in the component. I get an error message: Unexpecte

Web components with vaadin and rollup with svelte: Primary button ignores theme attribute

Maybe someone tried this before and is able to give me a hint. I have used normal svelte setup (mentioned in the main page) which scaffolds the app; npx degit s

How to add Google Analytics tracking ID in svelte

I want to add my Google Analytics Tracking ID- UA-XXXXXXXXX-X to my svelte app. I found two ways of doing it. First using Install the global site tag here <!

How to animate array values in svelte with tweened store?

I have a writable store with following data let array= writable({ skills: [{ id: 1,

Hide Svelte component from outside script

I am importing a third-party Svelte3 component with several children. For the sake of example, the third-party component looks like the following: <script>

Sveltekit - How to access a "reactive context" (a store passed down via context) in the Script tag of Child Component?

I'm initialising a Class in the onMount function of a Parent Wrapper component and want to expose it to all the children. I'm currently using a writable store t

How to change the default port 5000 in Svelte?

I am not getting how to change the default 5000 port in Svelte to some other port if we install the sample template through degit.