Commit b10e4597 authored by david's avatar david
Browse files

Build index file from template. #1

parent 6b040e69
...@@ -50,6 +50,12 @@ ...@@ -50,6 +50,12 @@
"resolve": "^1.11.0" "resolve": "^1.11.0"
} }
}, },
"@rollup/plugin-html": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/@rollup/plugin-html/-/plugin-html-0.2.0.tgz",
"integrity": "sha512-aT73feaTUmJIQ45K61+5pL9GE5IYgHi0SvQ+yhQfPG1HoDlPnIjk3af9IA/DxJ+8ZlWDWFcN3pik0VavWF88hw==",
"dev": true
},
"@rollup/plugin-node-resolve": { "@rollup/plugin-node-resolve": {
"version": "7.1.3", "version": "7.1.3",
"resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz", "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz",
......
...@@ -3,9 +3,7 @@ ...@@ -3,9 +3,7 @@
<head> <head>
<meta charset='utf-8'> <meta charset='utf-8'>
<meta name='viewport' content='width=device-width,initial-scale=1'> <meta name='viewport' content='width=device-width,initial-scale=1'>
<title>Aura Engine - Studio Clock</title> <title>Aura Engine - Studio Clock</title>
<link rel='icon' type='image/png' href='/favicon.png'> <link rel='icon' type='image/png' href='/favicon.png'>
<link rel='stylesheet' href='/build/aura-clock-bundle.css'> <link rel='stylesheet' href='/build/aura-clock-bundle.css'>
...@@ -13,19 +11,6 @@ ...@@ -13,19 +11,6 @@
</head> </head>
<body style="background-color: black;"> <body style="background-color: black;">
<aura-clock /> <aura-clock />
<!-- <aura-clock
name="Radio Orange"
logo="https://o94.at/themes/custom/radio_orange/logo1.png"
logosize="180px"
api="http://localhost:8008/api/v1/"
css="/css/o94.css"
unknowntitle="Unbekannter Titel"
nocurrentschedule="Derzeit keine Sendung"
nonextschedule="Keine weiteren Sendungen"
playoffset=3>
</aura-clock> -->
</body> </body>
</html> </html>
...@@ -5,6 +5,9 @@ import livereload from 'rollup-plugin-livereload'; ...@@ -5,6 +5,9 @@ import livereload from 'rollup-plugin-livereload';
import { terser } from 'rollup-plugin-terser'; import { terser } from 'rollup-plugin-terser';
import replace from '@rollup/plugin-replace'; import replace from '@rollup/plugin-replace';
import {config} from 'dotenv'; import {config} from 'dotenv';
const html = require('@rollup/plugin-html');
import fs from 'fs';
import path from 'path';
const production = !process.env.ROLLUP_WATCH; const production = !process.env.ROLLUP_WATCH;
...@@ -54,7 +57,19 @@ export default { ...@@ -54,7 +57,19 @@ export default {
// If we're building for production (npm run build // If we're building for production (npm run build
// instead of npm run dev), minify // instead of npm run dev), minify
production && terser() production && terser(),
html({
template() {
return new Promise((resolve) => {
const indexPath = path.join(__dirname, 'src/template.html');
fs.readFile(indexPath, 'utf-8', (err, data) => {
resolve(data);
});
});
}
}
)
], ],
watch: { watch: {
clearScreen: false clearScreen: false
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width,initial-scale=1'>
<title>Aura Engine - Studio Clock</title>
<link rel='icon' type='image/png' href='/favicon.png'>
<link rel='stylesheet' href='aura-clock-bundle.css'>
<script defer src='aura-clock-bundle.js'></script>
</head>
<body style="background-color: black;">
<aura-clock />
</body>
</html>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment