0.11.0 • Published 2 years ago

svite v0.11.0

Weekly downloads
179
License
MIT
Repository
github
Last release
2 years ago

svelte+vite=sweet

Every change in that gif is a separate hot module reload - seriously - build it yourself

features

  • reads svelte configuration from svelte.config.js
  • svelte preprocessor support
  • svelte dependency optimization in dev
  • svelte compiler result caching in dev
  • hot module reloading thanks to svelte-hmr
  • logging with configurable level
  • drop-in installation as vite plugin

quickstart

npx degit dominikg/svite/examples/minimal my-first-svite-project
cd my-first-svite-project
npm install
npm run dev # starts dev-server with hot-module-reloading
npm run build # builds to /dist

usage

installation

Install svite and vite as a dev dependency

npm install -D svite vite

project setup

Vite requires an index.html file at project root that serves as entry point. example

run

Svite has its own cli that wraps vite. It does not require a vite.config.js by default

{
  "scripts": {
    "dev": "svite",
    "build": "svite build"
  }
}

Advanced usage

svite cli

most of vite cli options can also be passed to svite.

commands

dev

Start a dev server with svite or svite dev

Usage: svite dev [options]

Options:
  -d,  --debug [boolean|string]   enable debug output. you can use true for "vite:*,svite:*" or supply your own patterns. Separate patterns with , start with - to filter. eg: "foo:*,-foo:bar"  (default: false)
  -c,  --config [string]          use specified vite config file
  -p,  --port [port]              port to use for serve (default: 3000)
  -sw, --serviceWorker [boolean]  enable service worker caching (default: false)
  -o,  --open [boolean]           open browser on start

build

Bundle for production with svite build

Usage: svite build [options]

Options:
  -d, --debug [boolean|string]               enable debug output. you can use true for "vite:*,svite:*" or supply your own patterns. Separate patterns with , start with - to filter. eg: "foo:*,-foo:bar"  (default: false)
  -c, --config [string]                      use specified vite config file
  -m, --mode [string]                        specify env mode (default: "production")
  --base [string]                            public base path for build (default: "/")
  --outDir [string]                          output directory for build (default: "dist")
  --assetsDir [string]                       directory under outDir to place assets in (default: "_assets")
  --assetsInlineLimit [number]               static asset base64 inline threshold in bytes (default: 4096)
  --sourcemap [boolean]                      output source maps for build (default: false)
  --minify [boolean | "terser" | "esbuild"]  enable/disable minification, or specify minifier to use. (default: "terser")
  --ssr [boolean]                            build for server-side rendering

svite options

you can pass additional options to svite via vite.config.js

const svite = require('svite');
const sviteConfig = {
  hot: true, // boolean or options object for svelte-hmr
  useTransformCache: true, // boolean
  svelte: {}, // options for rollup-plugin-svelte
};
module.exports = {
  plugins: [svite(sviteConfig)],
};
optiontypedefaultvalues
hotbooleanobjecttrue true use default svelte-hmr config false disable svelte-hmr object custom svelte-hmr config
useTransformCachebooleantrue true enable transform cache false disable transform cache
logLevelstring'info' 'debug'  'info'  'warn'  'error'  'silent'. cli 'debug' flag automatically sets logLevel to 'debug'
svelteobjectnot set object rollup-plugin-svelte config object

hot

Only change this option if you have to. See svelte-hmr for more Information

useTransformCache

Improves performance for reloads.

When a reload request hits the dev server, vite runs transforms again. this option caches the result of the last transform and reuses it if the file was not modified. Uses more ram, less cpu and is a bit faster.

logLevel

Set this to 'debug' if you want to see more output, use 'warn', 'error' or 'silent' for less. This only applies to svites own logging. Logging of vite remains unaffected. You can use --debug cli option to control vite debug output

svelte

use this option if you don't want to use svelte.config.js or need a quick override.

check out the examples

minimal

as barebones as it gets, just an essential App.svelte

postcss-tailwind

postcss and tailwindcss

routify-mdsvex

routify with support for mdsvex

svelte-preprocess-auto

typescript and svelte-preprocess in automatic mode. This is heavily based on the regular svelte-preprocess example

limitations

This is an early version, some things may not work as expected. Please report findings.

Got a question? / Need help?

Join svite discord

Credits

0.11.0

2 years ago

0.10.1

3 years ago

0.9.0

3 years ago

0.10.0

3 years ago

0.9.0-6

3 years ago

0.9.0-5

3 years ago

0.9.0-4

3 years ago

0.9.0-3

3 years ago

0.9.0-2

3 years ago

0.9.0-1

3 years ago

0.8.1-beta.2

3 years ago

0.8.1

3 years ago

0.8.1-beta.1

4 years ago

0.8.1-beta.0

4 years ago

0.8.0-beta.1

4 years ago

0.8.0

4 years ago

0.8.0-beta.0

4 years ago

0.7.2

4 years ago

0.7.1

4 years ago

0.7.1-beta.1

4 years ago

0.7.1-beta.0

4 years ago

0.7.0

4 years ago

0.7.0-beta.1

4 years ago

0.7.0-beta.0

4 years ago

0.6.1

4 years ago

0.6.1-beta.2

4 years ago

0.6.1-beta.1

4 years ago

0.6.1-beta.0

4 years ago

0.6.0

4 years ago

0.6.0-beta.0

4 years ago

0.6.0-beta.1

4 years ago

0.5.1-beta.1

4 years ago

0.5.1-beta.0

4 years ago

0.5.0

4 years ago

0.5.0-beta.1

4 years ago

0.5.0-beta.0

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.4.0-beta.0

4 years ago

0.3.3-beta.2

4 years ago

0.3.3-beta.1

4 years ago

0.3.3-beta.0

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.4

4 years ago

0.2.2-beta.6

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.2-beta.4

4 years ago

0.2.2-beta.3

4 years ago

0.2.2-beta.5

4 years ago

0.2.2-beta.1

4 years ago

0.2.2-beta.0

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.3

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago