A template for creating browser extensions using Svelte, TypeScript, and Vite.
# Clone the repository
git clone https://github.com/yourusername/svelte-extension-template.git
cd svelte-extension-template
# Install dependencies
npm install
# Start development server with auto-reload
npm run dev:ext
This will:
For a better development experience with automatic extension reloading:
# For Chromium-based browser (Chrome, Brave, Edge, etc.)
npm run dev:chrome
# For Firefox
npm run dev:firefox
These commands will:
# Build the extension for production
npm run build
The built extension will be in the dist
directory.
chrome://extensions/
dist
directoryabout:debugging#/runtime/this-firefox
manifest.json
file from the dist
directoryEdit public/manifest.json
to customize your extension's metadata, permissions, and behavior.
Replace the placeholder icons in the public/icons
directory with your own.
src/pages/background/index.ts
src/pages/content/index.ts
src/components/Popup.svelte
src/pages/popup/index.html
src/pages/popup/index.ts
src/components/Options.svelte
src/pages/options/index.html
src/pages/options/index.ts
All components in this template are optional. The build system automatically detects which components exist and includes only those in the build. To remove a component:
src/pages/
.public/manifest.json
file.src/components
.For example, to remove the options page:
src/pages/options/
directory.options_ui
field from the manifest.src/components/Options.svelte
.MIT