mirror of
https://github.com/fergalmoran/onearmy-community-platform.git
synced 2025-12-22 09:37:54 +00:00
feat: support custom favicons
Introduces support for loading favicon from the theme. This is not currently captured as part of the PlatformTheme type, instead it is based on the contents of src/assets/images/themes/:theme-name/public.
This commit is contained in:
@@ -78,6 +78,7 @@
|
|||||||
"final-form-calculate": "^1.3.2",
|
"final-form-calculate": "^1.3.2",
|
||||||
"firebase": "^8.8.1",
|
"firebase": "^8.8.1",
|
||||||
"framer-motion": "^4.1.17",
|
"framer-motion": "^4.1.17",
|
||||||
|
"fs-extra": "^10.0.0",
|
||||||
"fuse.js": "^6.4.6",
|
"fuse.js": "^6.4.6",
|
||||||
"is-url": "^1.2.4",
|
"is-url": "^1.2.4",
|
||||||
"leaflet": "^1.5.1",
|
"leaflet": "^1.5.1",
|
||||||
@@ -161,7 +162,6 @@
|
|||||||
"eslint": "^7.32.0",
|
"eslint": "^7.32.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.3.0",
|
||||||
"eslint-plugin-prettier": "^3.4.0",
|
"eslint-plugin-prettier": "^3.4.0",
|
||||||
"fs-extra": "7.0.1",
|
|
||||||
"husky": "^1.3.1",
|
"husky": "^1.3.1",
|
||||||
"idb": "^6.0.0",
|
"idb": "^6.0.0",
|
||||||
"lint-staged": "^8.1.5",
|
"lint-staged": "^8.1.5",
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
/>
|
/>
|
||||||
<meta
|
<meta
|
||||||
property="og:image"
|
property="og:image"
|
||||||
content="%PUBLIC_URL%/precious-plastic-logo-official.jpg"
|
content="%PUBLIC_URL%/social-image.jpg"
|
||||||
/>
|
/>
|
||||||
<meta property="og:url" content="https://community.preciousplastic.com" />
|
<meta property="og:url" content="https://community.preciousplastic.com" />
|
||||||
<meta name="twitter:title" content="Community Platform" />
|
<meta name="twitter:title" content="Community Platform" />
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
/>
|
/>
|
||||||
<meta
|
<meta
|
||||||
name="twitter:image"
|
name="twitter:image"
|
||||||
content="%PUBLIC_URL%/precious-plastic-logo-official.jpg"
|
content="%PUBLIC_URL%/social-image.jpg"
|
||||||
/>
|
/>
|
||||||
<meta name="twitter:card" content="summary_large_image" />
|
<meta name="twitter:card" content="summary_large_image" />
|
||||||
<!--
|
<!--
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@@ -1,4 +1,5 @@
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
import * as fsExtra from 'fs-extra'
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as cheerio from 'cheerio';
|
import * as cheerio from 'cheerio';
|
||||||
import dotenv from 'dotenv';
|
import dotenv from 'dotenv';
|
||||||
@@ -21,6 +22,9 @@ const $ = cheerio.load(builtHTML, { recognizeSelfClosing: true });
|
|||||||
* 4. SEO changes
|
* 4. SEO changes
|
||||||
* - Update <title> element
|
* - Update <title> element
|
||||||
* - Update description elements
|
* - Update description elements
|
||||||
|
* 5. Load assets into public/
|
||||||
|
* - favicon
|
||||||
|
* - og:url
|
||||||
*
|
*
|
||||||
* */
|
* */
|
||||||
|
|
||||||
@@ -52,6 +56,16 @@ const siteName = process.env.SITE_NAME || 'Community Platform';
|
|||||||
$('title').text(siteName)
|
$('title').text(siteName)
|
||||||
$('meta[property="og:title"]').attr('content', siteName);
|
$('meta[property="og:title"]').attr('content', siteName);
|
||||||
$('meta[name="twitter:title"]').attr('content', siteName);
|
$('meta[name="twitter:title"]').attr('content', siteName);
|
||||||
|
|
||||||
|
const platformTheme = process.env.REACT_APP_PLATFORM_THEME;
|
||||||
|
|
||||||
|
if (platformTheme) {
|
||||||
|
console.log(`Applying theme: ${platformTheme}`);
|
||||||
|
console.log(`Copying src/assets/theme/${platformTheme}/public to build/`);
|
||||||
|
fsExtra.copySync('../src/assets/images/themes/' + platformTheme + '/public', '../build');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const output = $.html();
|
const output = $.html();
|
||||||
|
|
||||||
console.log(`Persisting configuration and HTML updates back to ../build/index.html`);
|
console.log(`Persisting configuration and HTML updates back to ../build/index.html`);
|
||||||
|
|||||||
BIN
src/assets/images/themes/precious-plastic/public/favicon.ico
Normal file
BIN
src/assets/images/themes/precious-plastic/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
BIN
src/assets/images/themes/project-kamp/public/favicon.ico
Normal file
BIN
src/assets/images/themes/project-kamp/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
BIN
src/assets/images/themes/project-kamp/public/social-image.jpg
Normal file
BIN
src/assets/images/themes/project-kamp/public/social-image.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
24
yarn.lock
24
yarn.lock
@@ -14629,17 +14629,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"fs-extra@npm:7.0.1, fs-extra@npm:^7.0.0":
|
|
||||||
version: 7.0.1
|
|
||||||
resolution: "fs-extra@npm:7.0.1"
|
|
||||||
dependencies:
|
|
||||||
graceful-fs: ^4.1.2
|
|
||||||
jsonfile: ^4.0.0
|
|
||||||
universalify: ^0.1.0
|
|
||||||
checksum: 141b9dccb23b66a66cefdd81f4cda959ff89282b1d721b98cea19ba08db3dcbe6f862f28841f3cf24bb299e0b7e6c42303908f65093cb7e201708e86ea5a8dcf
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"fs-extra@npm:^0.30.0":
|
"fs-extra@npm:^0.30.0":
|
||||||
version: 0.30.0
|
version: 0.30.0
|
||||||
resolution: "fs-extra@npm:0.30.0"
|
resolution: "fs-extra@npm:0.30.0"
|
||||||
@@ -14675,6 +14664,17 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"fs-extra@npm:^7.0.0":
|
||||||
|
version: 7.0.1
|
||||||
|
resolution: "fs-extra@npm:7.0.1"
|
||||||
|
dependencies:
|
||||||
|
graceful-fs: ^4.1.2
|
||||||
|
jsonfile: ^4.0.0
|
||||||
|
universalify: ^0.1.0
|
||||||
|
checksum: 141b9dccb23b66a66cefdd81f4cda959ff89282b1d721b98cea19ba08db3dcbe6f862f28841f3cf24bb299e0b7e6c42303908f65093cb7e201708e86ea5a8dcf
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"fs-extra@npm:^8.1.0":
|
"fs-extra@npm:^8.1.0":
|
||||||
version: 8.1.0
|
version: 8.1.0
|
||||||
resolution: "fs-extra@npm:8.1.0"
|
resolution: "fs-extra@npm:8.1.0"
|
||||||
@@ -21288,7 +21288,7 @@ fsevents@^1.2.7:
|
|||||||
final-form-calculate: ^1.3.2
|
final-form-calculate: ^1.3.2
|
||||||
firebase: ^8.8.1
|
firebase: ^8.8.1
|
||||||
framer-motion: ^4.1.17
|
framer-motion: ^4.1.17
|
||||||
fs-extra: 7.0.1
|
fs-extra: ^10.0.0
|
||||||
fuse.js: ^6.4.6
|
fuse.js: ^6.4.6
|
||||||
husky: ^1.3.1
|
husky: ^1.3.1
|
||||||
idb: ^6.0.0
|
idb: ^6.0.0
|
||||||
|
|||||||
Reference in New Issue
Block a user