Opinionated starter template for SvelteKit
The Svelte-world is akin to the universes of Mad Max and Split collided - full of peril, violent sandstorms and new beginnings with a touch of disassociative personality disorder.
To help navigate through this madness, just like how Moses parted the Red Sea, behold the emergence of this repo. Cue angels singing. The best way to describe this is it's like a brick-layer - but instead of bricks are Svelte's somewhat arbitrary building blocks. And instead of cement are my opinions.
So let's get started.
This combo-patcher uses zx, so make sure that's installed - then run:
$ zx --install https://raw.githubusercontent.com/zerodevx/sveltekit-starter/main/index.js <app-name> [flags]
This generates the starter based on the last known SvelteKit decisions, then saves the output to
/app-name
.
Flag | Type | Default | Description |
---|---|---|---|
-o | boolean | false | Overwrite existing path if exists |
-t | ('skeleton'|'skeletonlib'|'default') | 'skeleton' | Base template from create-svelte |
Base create-svelte
skeleton template with jsdoc
, prettier
, eslint
and playwright
.
Add tailwindcss
using svelte-add
.
No semicolons; because they're redundant. Also use spaces over tabs - modern code editors handle both well, but spaces display better outside IDEs (I'm looking at you Github).
{
// ...
"printWidth": 100,
"useTabs": false,
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"proseWrap": "always",
"svelteSortOrder": "options-scripts-markup-styles",
"svelteIndentScriptAndStyle": false
}
Add defence against no-semi
:
module.exports = {
...
rules: {
'no-tabs': 'error',
'no-unexpected-multiline': 'error'
}
}
Seriously, don't use SSR unless you really need to. Installs adapter-static
and adds sensible
defaults.
ISC