There are many ways to integrate Svelte with Neutralino, this template shows one of them
- How to use this template
- Manually integrate Svelte with Neutralino
- Running and Building
- Using TypeScript
- Icon credits
-
Create a Neutralino app using this template by running:
npx degit anotherempty/neutralino-svelte-template your-app
-
Open your app base folder and initialize the Neutralino binaries:
neu update
-
Go inside the
svelte
folder and install its dependencies:npm install
-
Finally run in dev mode or build your app, see the Running and Building section on how to.
-
Create a Neutralino project with
neu create
-
Open the Neutralino base folder and add Svelte:
npx degit sveltejs/template svelte
-
(Optional) Delete the
README.md
from the svelte folder -
Copy the content of the Svelte
.gitignore
file inside the Neutralino.gitignore
file then delete the Svelte.gitignore
file -
Copy the
resources/js/neutralino.js
file tosvelte/public/
-
Import the
neutralino.js
file insidesvelte/public/index.html
:<script defer src="./build/bundle.js"></script> <script src="./neutralino.js"></script>
-
Copy the
resources/icons/trayIcon.png
file tosvelte/public/
-
(Optional) Copy the contents of
resources/js/main.js
inside the script tag ofsvelte/src/App.svelte
and change thetrayIcon.png
path inside the setTray() function.Then copy the contents of the body of
resources/index.html
insidesvelte/src/App.svelte
-
Open
neutralino.config.json
and change documentRoot, modes.window.icon, modes.cloud.url (optional if you're building a window app), cli.resourcesPath, and cli.clientLibrary:{ ... "documentRoot": "/svelte/public/", ... "modes": { "window": { "icon": "/svelte/public/favicon.png", } ... "cloud": { "url": "/svelte/public/#cloud", } ... } ... "cli": { "resourcesPath": "/svelte/public/", "clientLibrary": "/svelte/public/neutralino.js", } }
-
Finally, delete the
resources
folder
Open the svelte
folder and install its dependencies ...
npm install
...then start Rollup...
npm run dev
...then open the base folder from another terminal and start Neutralino:
neu run
Open the svelte
folder and run the build command ...
npm run build
... then from the base folder, build the Neutralino app
neu build
Go inside the svelte
folder and run :
node scripts/setupTypeScript.js