Skip to content

Latest commit

 

History

History
63 lines (44 loc) · 1 KB

svelte.md

File metadata and controls

63 lines (44 loc) · 1 KB

Svelte flake template

Using this template

mkdir my-project
cd my-project
nix flake init --refresh -t github:cor/flake-templates\#svelte

Initializing your project

You will need to run the following commands once in order to create your Svelte app:

nix develop
npm create svelte@latest .
echo "result" >> .gitignore
echo ".direnv" >> .gitignore
yarn
yarn add -D @sveltejs/adapter-node

Then, open the file svelte.config.js, and change the first line from:

import adapter from '@sveltejs/adapter-auto';

to

import adapter from '@sveltejs/adapter-node';

(If this doesn't work, check the adapter-node docs).

Finally, run

git init
git add -A
git commit -m "init"

You can now reproducibly build and run your Svelte project with Nix!

ORIGIN=http://localhost:3000 nix run

Enter a Svelte devshell

nix develop

Build your project with Nix

nix build