vscode-svelte-pluskit-snippets Svelte Themes

Vscode Svelte Pluskit Snippets

vscode-svelte-pluskit-snippets

vscode-svelte-pluskit-snippets

Visual Studio Marketplace Version

Adds starter snippets for:

  • +page.ts
  • +page.server.ts
  • +page.svelte
  • +layout.ts
  • +layout.server.ts
  • +layout.svelte
  • +server.ts
  • +error.svelte

with the types imported and the common exported things, for example:

+page.ts

import { error, invalid, redirect } from "@sveltejs/kit";
import type { PageServerLoad, Actions } from "./$types";

export const load: PageServerLoad = async function (event) {
  return {};
};

export const actions: Actions = {
  default: async (event) => {
    return {};
  },
};

OK, and here's the really nice part, it adds a keyboard shortcut cmd+k n that automatically inserts the snippet that corresponds to the file you are in (make sure its blank). So you don't have to remember all the boilerplate for each file just create the file and cmd+k n in whatever file type of +kit.

File an issue here if there are more templates to be added or more things you think should be in the templates by default.

Sponsors

License

MIT License © 2022 Garland Crow

Top categories

Loading Svelte Themes