Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove FontAwesome #458

Open
malberts opened this issue Feb 25, 2025 · 5 comments
Open

Remove FontAwesome #458

malberts opened this issue Feb 25, 2025 · 5 comments
Milestone

Comments

@malberts
Copy link
Contributor

Instead of maintaining a copy of FontAwesome in Chameleon, rather remove it and have an optional dependency on Extension:FontAwesome.

Chameleon can still define default icons and additonal FontAwesome-specific styling, but that will only be used if Extension:FontAwesome is enabled.

This will likely only be implemented along with the upgrade to Boostrap 5.3 (#385).

@malberts malberts added this to the 6.0.0 milestone Feb 25, 2025
@JeroenDeDauw
Copy link
Member

Would that mean that all these icons disappear unless you install the FA extension?

Image

@malberts
Copy link
Contributor Author

Yes. The user menu icon will probably need some special attention (maybe using a Codex icon, don't know).

@WouterRademaker
Copy link
Contributor

WouterRademaker commented Feb 25, 2025

This is what is roughly required for a hard dependency:

/skins/chameleon/src/Hooks/SetupAfterCache.php

--- SetupAfterCache.php.orig	2025-02-21 14:54:49.000000000 +0100
+++ SetupAfterCache.php	2025-02-25 20:29:22.812229481 +0100
@@ -69,6 +69,8 @@
 	protected function setInstallPaths(): void {
 		$GLOBALS[ 'chameleonLocalPath' ] = $this->configuration['wgStyleDirectory'] . '/chameleon';
 		$GLOBALS[ 'chameleonRemotePath' ] = $this->configuration['wgStylePath'] . '/chameleon';
+		$GLOBALS[ 'fontawesomeLocalPath' ] = $this->configuration['wgExtensionDirectory'] . '/FontAwesome';
+		$GLOBALS[ 'fontawesomeRemotePath' ] = $this->configuration['wgExtensionAssetsPath'] . '/FontAwesome';
 	}
 
 	protected function addLateSettings() {
@@ -92,25 +94,25 @@
 			);
 		}
 
 
 		$this->bootstrapManager->addStyleFile(
-			$GLOBALS[ 'chameleonLocalPath' ] . '/resources/fontawesome/scss/fontawesome.scss'
+			$GLOBALS[ 'fontawesomeLocalPath' ] . '/res/fontawesome/scss/fontawesome.scss'
 		);
 
 		$this->bootstrapManager->addStyleFile(
-			$GLOBALS[ 'chameleonLocalPath' ] . 	'/resources/fontawesome/scss/fa-solid.scss'
+			$GLOBALS[ 'fontawesomeLocalPath' ] . '/res/fontawesome/scss/solid.scss'
 		);
 
 		$this->bootstrapManager->addStyleFile(
-			$GLOBALS[ 'chameleonLocalPath' ] . '/resources/fontawesome/scss/fa-regular.scss'
+			$GLOBALS[ 'fontawesomeLocalPath' ] . '/res/fontawesome/scss/regular.scss'
 		);
 
 		$this->bootstrapManager->addStyleFile(
-			$GLOBALS[ 'chameleonLocalPath' ] . '/resources/fontawesome/scss/fa-brands.scss'
+			$GLOBALS[ 'fontawesomeLocalPath' ] . '/res/fontawesome/scss/brands.scss'
 		);
 
 		$this->bootstrapManager->addStyleFile(
@@ -115,8 +117,9 @@
 
 		$this->bootstrapManager->setScssVariable(
 			'fa-font-path',
-			$GLOBALS[ 'chameleonRemotePath' ] . '/resources/fontawesome/webfonts'
+			$GLOBALS[ 'fontawesomeRemotePath' ] . '/res/fontawesome/webfonts'
 		);
 	}

/skins/chameleon/resources/styles/_fixes.scss

--- _fixes.scss.orig	2025-02-21 14:54:49.000000000 +0100
+++ _fixes.scss	2025-02-25 19:25:29.394663736 +0100
@@ -29,18 +29,18 @@
 
 .fa, .fas {
 	&:before {
-		font-family: 'Font Awesome 5 Free';
+		font-family: 'Font Awesome 6 Free';
 		font-weight: 900;
 	}
 }
 
 .far:before {
-	font-family: 'Font Awesome 5 Free';
+	font-family: 'Font Awesome 6 Free';
 	font-weight: 400;
 }
 
 .fab:before {
-	font-family: 'Font Awesome 5 Brands';
+	font-family: 'Font Awesome 6 Brands';
 }
 
 // When there is a "small" in the hierarchy, we mean it

@WouterRademaker
Copy link
Contributor

Font Awesome 5 from chameleon skin:
Image
Font Awesome 6 from Font Awesome extension:
Image

@WouterRademaker
Copy link
Contributor

WouterRademaker commented Feb 25, 2025

Also needed is a small change in /extensions/FontAwesome/package.json and the build scripts run:

--- package.json.orig	2025-02-10 12:16:11.405823626 +0100
+++ package.json	2025-02-25 22:33:08.917649227 +0100
@@ -1,7 +1,7 @@
 {
   "scripts": {
     "prebuild": "npm install",
-    "build:fontawesome": "bash -c \"if [ -d res/fontawesome ]; then rm -rf res/fontawesome; fi && mkdir -p res/fontawesome && cp -R node_modules/@fortawesome/fontawesome-free/{css,js,webfonts,LICENSE.txt} res/fontawesome\"",
+    "build:fontawesome": "bash -c \"if [ -d res/fontawesome ]; then rm -rf res/fontawesome; fi && mkdir -p res/fontawesome && cp -R node_modules/@fortawesome/fontawesome-free/{css,js,scss,webfonts,LICENSE.txt} res/fontawesome\"",
     "build": "npm run build:fontawesome"
   },
   "devDependencies": {

So the second image in my previous comment is with the most recent Font Awesome version: Release 6.7.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants