diff --git a/.gitignore b/.gitignore
index a9e1726..508a790 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,3 @@ node_modules
config.custom.js
config.temp.js
package-lock.json
-/gui/dashboard/build/
diff --git a/builddashboard.js b/builddashboard.js
new file mode 100644
index 0000000..a72b805
--- /dev/null
+++ b/builddashboard.js
@@ -0,0 +1,47 @@
+'use strict';
+
+const svelte = require('rollup-plugin-svelte');
+const { terser } = require('rollup-plugin-terser')
+const { rollup } = require('rollup');
+const { default: resolve } = require('@rollup/plugin-node-resolve');
+const { minify: minifyCSS } = require('csso');
+
+async function build() {
+ let cssOutput = '';
+
+ try {
+ const bundle = await rollup({
+ input: __dirname + '/gui/dashboard/index.js',
+ plugins: [ svelte({
+ emitCss: false,
+ compilerOptions: {
+ dev: false,
+ generate: 'dom',
+ },
+ preprocess: {
+ style: ({ content }) => {
+ cssOutput = minifyCSS(content);
+ return '';
+ },
+ },
+ }), resolve(), terser() ],
+ });
+
+ const { output } = await bundle.generate({
+ sourcemap: true,
+ format: 'iife',
+ name: 'app',
+ file: 'public/build/bundle.js',
+ });
+
+ return {
+ code: output[0].code,
+ css: cssOutput,
+ };
+ }
+ catch (error) {
+ console.error('Error while building status dashboard: ', error);
+ }
+}
+
+module.exports = build;
diff --git a/dashboard/index.js b/dashboard/index.js
deleted file mode 100644
index f034db4..0000000
--- a/dashboard/index.js
+++ /dev/null
@@ -1,31 +0,0 @@
-'use strict';
-
-const { build: viteBuild } = require('vite');
-const fs = require('fs').promises;
-const { svelte } = require('@sveltejs/vite-plugin-svelte');
-
-const path = __dirname + '/../gui/dashboard';
-
-const build = (prefix = '') => viteBuild({
- root: path,
- base: `${prefix}/statusdashboard/asset/`,
- plugins: [ svelte() ],
- build: {
- rollupOptions: {
- output: {
- assetFileNames: '[hash].[ext]',
- entryFileNames: '[hash].js',
- chunkFileNames: '[hash].js',
- },
- },
- outDir: path + '/build',
- },
-});
-
-const cleanup = () => fs.rm(path + '/build', {
- recursive: true,
- force: true,
-});
-
-module.exports = { build, cleanup, path };
-build();
diff --git a/dashboard/watcher.js b/dashboard/watcher.js
deleted file mode 100644
index 3b27f98..0000000
--- a/dashboard/watcher.js
+++ /dev/null
@@ -1,32 +0,0 @@
-'use strict';
-
-const chokidar = require('chokidar');
-const dashboard = require('./index');
-
-let watcher;
-const handler = async () => {
- console.log('status dashboard watcher triggered, rebuilding...');
- await dashboard.cleanup();
- await dashboard.build();
- process.send({ command: 'reload' });
-};
-
-process.on('message', message => {
- switch (message.command) {
- case 'start':
- if (message.path) {
- watcher = chokidar.watch(message.path, {
- ignored: [ /node_modules/, /build/ ],
- });
-
- watcher.on('add', handler);
- watcher.on('change', handler);
- watcher.on('unlink', handler);
- }
- break;
-
- default:
- console.log(`Status dashboard watcher received unknown command ${message.command}`);
- break;
- }
-});
diff --git a/gui/dashboard/app.svelte b/gui/dashboard/app.svelte
index 727f2dd..75d9c8d 100644
--- a/gui/dashboard/app.svelte
+++ b/gui/dashboard/app.svelte
@@ -1,10 +1,14 @@
-here comes the dashboard
-