📈 Add umami code
This commit is contained in:
parent
4a965e28b7
commit
d73ec6ba7b
5 changed files with 57 additions and 2 deletions
|
|
@ -1,3 +1,5 @@
|
|||
/* global process */
|
||||
|
||||
const { parse } = require('@ltd/j-toml');
|
||||
const { render } = require('mustache');
|
||||
const { readFile, writeFile } = require('node:fs/promises');
|
||||
|
|
@ -13,11 +15,18 @@ async function compile() {
|
|||
const config = parse(confToml);
|
||||
|
||||
config.version = stdout.trim();
|
||||
config.slug = function () {
|
||||
return this.text ? this.text.toLowerCase() : this.icon;
|
||||
};
|
||||
config.text = function () {
|
||||
const string = this.icon;
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
};
|
||||
|
||||
if (process.argv[2] === 'dev') {
|
||||
config.umami.website_id = config.umami.dev_website_id;
|
||||
}
|
||||
|
||||
const tempPath = resolve('./index.html');
|
||||
const template = await readFile(tempPath, { encoding: 'utf8' });
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue