mirror of
https://github.com/smartyellow/status.git
synced 2025-01-18 13:37:59 +00:00
Improved build process
Signed-off-by: Romein van Buren <romein@vburen.nl>
This commit is contained in:
parent
08bb63415c
commit
b3fd94b02a
@ -1,37 +1,43 @@
|
||||
'use strict';
|
||||
|
||||
const { minify: minifyCSS } = require('csso');
|
||||
const { rollup } = require('rollup');
|
||||
const commonjs = require('@rollup/plugin-commonjs');
|
||||
const css = require('rollup-plugin-css-only');
|
||||
const { default: resolve } = require('@rollup/plugin-node-resolve');
|
||||
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 = { css: '', map: null };
|
||||
let cssOutput = '';
|
||||
|
||||
try {
|
||||
const bundle = await rollup({
|
||||
input: __dirname + '/gui/dashboard/index.js',
|
||||
plugins: [
|
||||
// Svelte
|
||||
svelte({
|
||||
emitCss: false,
|
||||
compilerOptions: {
|
||||
dev: false,
|
||||
generate: 'dom',
|
||||
},
|
||||
preprocess: {
|
||||
style: ({ content }) => {
|
||||
cssOutput = minifyCSS(content);
|
||||
return '';
|
||||
},
|
||||
},
|
||||
}),
|
||||
|
||||
// Extract CSS
|
||||
css({
|
||||
output: style => cssOutput = minifyCSS(style),
|
||||
}),
|
||||
|
||||
// Resolve dependencies
|
||||
resolve({
|
||||
browser: true,
|
||||
dedupe: [ 'svelte' ],
|
||||
}),
|
||||
|
||||
// CommonJS functions
|
||||
commonjs(),
|
||||
|
||||
// Minify
|
||||
terser(),
|
||||
],
|
||||
});
|
||||
|
@ -11,7 +11,7 @@
|
||||
</div>
|
||||
|
||||
<style>
|
||||
:global(html, body) {
|
||||
:global(html), :global(body) {
|
||||
--radius: 10px;
|
||||
--tile-bg: #181818;
|
||||
|
||||
|
5
index.js
5
index.js
@ -3,6 +3,7 @@
|
||||
const { fork } = require('child_process');
|
||||
const { processOutage } = require('./lib/processoutage');
|
||||
const buildDashboard = require('./builddashboard');
|
||||
const { minifyHtml } = require('core/strings');
|
||||
|
||||
const guiCluster = 'web service status';
|
||||
const icons = {
|
||||
@ -537,7 +538,7 @@ module.exports = {
|
||||
if (!renderedDashboard) {
|
||||
renderedDashboard = await buildDashboard();
|
||||
}
|
||||
const dashboardHtml = `
|
||||
const dashboardHtml = minifyHtml(`
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@ -550,7 +551,7 @@ module.exports = {
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
`;
|
||||
`);
|
||||
res.send(dashboardHtml);
|
||||
},
|
||||
},
|
||||
|
@ -17,6 +17,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/smartyellow/status#readme",
|
||||
"dependencies": {
|
||||
"csso": "^5.0.3"
|
||||
"csso": "^5.0.3",
|
||||
"rollup-plugin-css-only": "^3.1.0"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user