matths / svelte-client-server-rollup-template

Svelte Client/Server Rollup template

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

svelte client server rollup template

This is my attempt of a project template for a Svelte app as a client and a Node.js app a server. It lives at https://github.com/matths/svelte-client-server-rollup-template.

It is using Rollup for both worlds, offering automatic server restart, http with ssl and live reload for the client app.

Get started

Install the dependencies.

cd svelte-client-server-rollup-template
npm install

Create a self-signed certificate.

cd svelte-client-server-rollup-template
npm run create-ssl

Bundle both, the client and the server and run the server, delivering the client with a single command.

npm run dev

Navigate to 127.0.0.1:8000. You should see a basic example app running. Edit a component file either in src/client or src/server, save it. Because of livereload, you should see your changes immediately.

For the server, I currently usesirv, too, but as a middleware. So you can start writing your own server code as far as you still deliver your client app files as well.

About

Svelte Client/Server Rollup template

License:MIT License


Languages

Language:JavaScript 42.1%Language:Svelte 20.5%Language:Shell 16.8%Language:CSS 14.0%Language:HTML 6.6%