diff options
author | Jan-Eric Schober <je@schober.industries> | 2022-05-23 17:54:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-23 23:54:48 +0800 |
commit | b65ad70f5358fbf5bef2875111d5f58bd39854b8 (patch) | |
tree | 71ee0142bbf38cceaecbc4c114572470f717127a /build/generate-images.js | |
parent | d2a91e5e592814f1ecf6934fc714d2a9694500ef (diff) | |
download | gitea-b65ad70f5358fbf5bef2875111d5f58bd39854b8.tar.gz gitea-b65ad70f5358fbf5bef2875111d5f58bd39854b8.zip |
Add the possibility to allow the user to have a favicon which differs from the main logo (#18542)
* Changed the filename of the favicon SVG
This allows the user to have a favicon which differs from the logo.
* Added favicon.svg
This is needed to accommodate the changes for allowing the user to have a differing logo and favicon
* Adjusted page to accommodate what icon is used as favicon
* Added functionality to also generate the favicon.svg via generate-images.js
* Adjusted the description for the new favicon compatibility
Co-authored-by: silverwind <me@silverwind.io>
* Updated generate-images.js to generate favicons from a separate favicons.svg file
This belongs to PR #18542.
* Added description on how custom favicons can be generated
* Replaced space indents with tabs
* Synced changes with current state of the file
* Synced changes with current state of the file
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'build/generate-images.js')
-rwxr-xr-x | build/generate-images.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/build/generate-images.js b/build/generate-images.js index b8284b1be2..0a91d896a8 100755 --- a/build/generate-images.js +++ b/build/generate-images.js @@ -8,6 +8,7 @@ import {fileURLToPath} from 'url'; const {readFile, writeFile} = fs.promises; const __dirname = dirname(fileURLToPath(import.meta.url)); const logoFile = resolve(__dirname, '../assets/logo.svg'); +const faviconFile = resolve(__dirname, '../assets/favicon.svg'); function exit(err) { if (err) console.error(err); @@ -68,15 +69,17 @@ async function generate(svg, outputFile, {size, bg}) { async function main() { const gitea = process.argv.slice(2).includes('gitea'); - const svg = await readFile(logoFile, 'utf8'); + const logoSvg = await readFile(logoFile, 'utf8'); + const faviconSvg = await readFile(faviconFile, 'utf8'); await Promise.all([ - generate(svg, resolve(__dirname, '../public/img/logo.svg'), {size: 32}), - generate(svg, resolve(__dirname, '../public/img/logo.png'), {size: 512}), - generate(svg, resolve(__dirname, '../public/img/favicon.png'), {size: 180}), - generate(svg, resolve(__dirname, '../public/img/avatar_default.png'), {size: 200}), - generate(svg, resolve(__dirname, '../public/img/apple-touch-icon.png'), {size: 180, bg: true}), - gitea && generate(svg, resolve(__dirname, '../public/img/gitea.svg'), {size: 32}), + generate(logoSvg, resolve(__dirname, '../public/img/logo.svg'), {size: 32}), + generate(logoSvg, resolve(__dirname, '../public/img/logo.png'), {size: 512}), + generate(faviconSvg, resolve(__dirname, '../public/img/favicon.svg'), {size: 32}), + generate(faviconSvg, resolve(__dirname, '../public/img/favicon.png'), {size: 180}), + generate(logoSvg, resolve(__dirname, '../public/img/avatar_default.png'), {size: 200}), + generate(logoSvg, resolve(__dirname, '../public/img/apple-touch-icon.png'), {size: 180, bg: true}), + gitea && generate(logoSvg, resolve(__dirname, '../public/img/gitea.svg'), {size: 32}), ]); } |