diff --git a/build/generate-images.js b/build/generate-images.js
index 7a00395a5..9b7b82017 100755
--- a/build/generate-images.js
+++ b/build/generate-images.js
@@ -6,6 +6,7 @@ const {fabric} = require('fabric');
const {DOMParser, XMLSerializer} = require('xmldom');
const {readFile, writeFile} = require('fs').promises;
const {resolve} = require('path');
+const Svgo = require('svgo');
function exit(err) {
if (err) console.error(err);
@@ -20,6 +21,25 @@ function loadSvg(svg) {
});
}
+async function generateSvgFavicon(svg, outputFile) {
+ const svgo = new Svgo({
+ plugins: [
+ {removeDimensions: true},
+ {
+ addAttributesToSVGElement: {
+ attributes: [
+ {'width': '32'},
+ {'height': '32'},
+ ],
+ },
+ },
+ ],
+ });
+
+ const {data} = await svgo.optimize(svg);
+ await writeFile(outputFile, data);
+}
+
async function generate(svg, outputFile, {size, bg, removeDetail} = {}) {
const parser = new DOMParser();
const serializer = new XMLSerializer();
@@ -67,6 +87,7 @@ async function generate(svg, outputFile, {size, bg, removeDetail} = {}) {
async function main() {
const svg = await readFile(resolve(__dirname, '../assets/logo.svg'), 'utf8');
+ await generateSvgFavicon(svg, resolve(__dirname, '../public/img/favicon.svg'));
await generate(svg, resolve(__dirname, '../public/img/gitea-lg.png'), {size: 880});
await generate(svg, resolve(__dirname, '../public/img/gitea-512.png'), {size: 512});
await generate(svg, resolve(__dirname, '../public/img/gitea-192.png'), {size: 192});
diff --git a/public/img/favicon.svg b/public/img/favicon.svg
new file mode 100644
index 000000000..88dae5306
--- /dev/null
+++ b/public/img/favicon.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl
index 0f863b831..0760354e4 100644
--- a/templates/base/head.tmpl
+++ b/templates/base/head.tmpl
@@ -58,7 +58,8 @@
{{end}}
};
-
+
+
{{if .RequireSimpleMDE}}