This repo serves as a frontend/static Svelte app project starter to quickly scaffold a new svelte app without worrying about how to configure add-ins and bundling.
npx degit ejolly/create-svelte-app yourAppName
cd yourAppName
npm install
npm run dev
and navigate tolocalhost:5000
in your browser
- Tailwindcss for styling, with purging of unused styles for production
- ESlint for linting, based on the airbnb config
- Prettier for formatting configured to work with svelte
- Husky to auto-check styles pre-commit
- A special global
DEV
variable available for use anywhere in the app (noimport
required) that resolves totrue
when built and served/deployed for production (server launched withnpm run build && yourServer public
) andfalse
when built for development (server launched withnpm run dev
).- This can be super handy when you want to inject some debug behavior into your app while you're working, but not in production without having to read/load configuration variables and files.
- Just write the code once and wrap it in a
if (DEV){}
block to run only during development DEV
works because of@rollup/plugin-replace
which literally does a string replacement based upon how rollup was initialized. This means you can't "react" or "observe" this variable. It's injected when the app is compiled.
If you use the recommended extensions in this repo then you should get the following features:
- live error-checking as you type
- auto-formatting on save
- svelte intellisense
- tailwindcss class name intellisense including for
@apply
directive - tailwincss class name sorting via Headwind
A fast way to go live is to hook up your github repo with Netlify:
- Sign-up/in on netlify with your github account
- Create a new project based on the github repo you want to deploy
- For the build command use:
npm run build
- For the folder to serve use
public
Now any new pushes to your master
branch will automatically update live!
The master
branch of this repo serves as the Base configuration for a few other scaffolds. Feel free to submit your own template after forking from master
.
- Base + Firebase
- Base + NeDB
- Version 1 (this is the only variant that does not build on top of Base: bulma, svelma, font-awesome, svelte-router-spa, firebase, babel/core-js)
This was originally based off of sveltejs/template@431bd4