mirror of
https://github.com/smartyellow/status.git
synced 2025-01-18 13:37:59 +00:00
Fixed dashboard errors
Signed-off-by: Romein van Buren <romein@vburen.nl>
This commit is contained in:
parent
689e858228
commit
08bb63415c
@ -4,27 +4,36 @@ 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 commonjs = require('@rollup/plugin-commonjs');
|
||||
const { minify: minifyCSS } = require('csso');
|
||||
|
||||
async function build() {
|
||||
let cssOutput = '';
|
||||
let cssOutput = { css: '', map: null };
|
||||
|
||||
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 '';
|
||||
plugins: [
|
||||
svelte({
|
||||
emitCss: false,
|
||||
compilerOptions: {
|
||||
dev: false,
|
||||
generate: 'dom',
|
||||
},
|
||||
},
|
||||
}), resolve(), terser() ],
|
||||
preprocess: {
|
||||
style: ({ content }) => {
|
||||
cssOutput = minifyCSS(content);
|
||||
return '';
|
||||
},
|
||||
},
|
||||
}),
|
||||
resolve({
|
||||
browser: true,
|
||||
dedupe: [ 'svelte' ],
|
||||
}),
|
||||
commonjs(),
|
||||
terser(),
|
||||
],
|
||||
});
|
||||
|
||||
const { output } = await bundle.generate({
|
||||
@ -36,7 +45,7 @@ async function build() {
|
||||
|
||||
return {
|
||||
code: output[0].code,
|
||||
css: cssOutput,
|
||||
css: cssOutput.css,
|
||||
};
|
||||
}
|
||||
catch (error) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
import App from './app.svelte';
|
||||
|
||||
export default new App({
|
||||
target: document.body,
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
new App({
|
||||
target: document.getElementsByTagName('body')[0],
|
||||
});
|
||||
});
|
||||
|
2
index.js
2
index.js
@ -1,6 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
require('svelte/register');
|
||||
const { fork } = require('child_process');
|
||||
const { processOutage } = require('./lib/processoutage');
|
||||
const buildDashboard = require('./builddashboard');
|
||||
@ -538,7 +537,6 @@ module.exports = {
|
||||
if (!renderedDashboard) {
|
||||
renderedDashboard = await buildDashboard();
|
||||
}
|
||||
console.log(renderedDashboard);
|
||||
const dashboardHtml = `
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
@ -3,9 +3,6 @@
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"directories": {
|
||||
"lib": "lib"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user