From 8e8ed199f51a0a188821a0fcdba600d9071d305d Mon Sep 17 00:00:00 2001 From: Sami Mazouz Date: Thu, 19 Sep 2024 17:29:34 +0100 Subject: [PATCH] feat: fontawesome v6 --- composer.json | 4 ++-- framework/core/composer.json | 2 +- framework/core/less/common/Iconography.less | 9 ++++----- framework/core/src/Frontend/Compiler/LessCompiler.php | 7 ++++++- framework/core/src/Frontend/FrontendServiceProvider.php | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index f117d70217..9c0481ba4c 100644 --- a/composer.json +++ b/composer.json @@ -107,12 +107,13 @@ "require": { "php": "^8.2", "ext-json": "*", - "components/font-awesome": "^5.15.0", + "components/font-awesome": "^6.5.2", "composer/composer": "^2.7", "dflydev/fig-cookies": "^3.0", "doctrine/dbal": "^3.6.2", "dragonmantank/cron-expression": "^3.3", "fakerphp/faker": "^1.9.1", + "flarum/json-api-server": "^0.1.0", "franzl/whoops-middleware": "2.0", "guzzlehttp/guzzle": "*", "illuminate/bus": "^11.0", @@ -161,7 +162,6 @@ "symfony/postmark-mailer": "^7.0", "symfony/translation": "^7.0", "symfony/yaml": "^7.0", - "flarum/json-api-server": "^0.1.0", "wikimedia/less.php": "^4.1" }, "require-dev": { diff --git a/framework/core/composer.json b/framework/core/composer.json index f7a4c8e559..a60bbdbd98 100644 --- a/framework/core/composer.json +++ b/framework/core/composer.json @@ -37,7 +37,7 @@ }, "require": { "php": "^8.2", - "components/font-awesome": "^5.15.0", + "components/font-awesome": "^6.5.2", "dflydev/fig-cookies": "^3.0", "doctrine/dbal": "^3.6", "dragonmantank/cron-expression": "*", diff --git a/framework/core/less/common/Iconography.less b/framework/core/less/common/Iconography.less index 01a45d9fab..1edd1af054 100644 --- a/framework/core/less/common/Iconography.less +++ b/framework/core/less/common/Iconography.less @@ -1,5 +1,4 @@ -@import "fontawesome"; -@import "brands"; -@import "regular"; -@import "solid"; -@fa-font-path: "./fonts"; +@import (inline) "fontawesome.css"; +@import (inline) "brands.css"; +@import (inline) "regular.css"; +@import (inline) "solid.css"; diff --git a/framework/core/src/Frontend/Compiler/LessCompiler.php b/framework/core/src/Frontend/Compiler/LessCompiler.php index 10e8750c57..734e4c59c6 100644 --- a/framework/core/src/Frontend/Compiler/LessCompiler.php +++ b/framework/core/src/Frontend/Compiler/LessCompiler.php @@ -96,7 +96,12 @@ protected function compile(array $sources): string $parser->registerFunction($name, $callback); } - return $parser->getCss(); + return $this->finalize($parser->getCss()); + } + + protected function finalize(string $parsedCss): string + { + return str_replace('url("../webfonts/', 'url("./fonts/', $parsedCss); } protected function overrideSources(array $sources): array diff --git a/framework/core/src/Frontend/FrontendServiceProvider.php b/framework/core/src/Frontend/FrontendServiceProvider.php index bc859d89e9..e38a7a8cc6 100644 --- a/framework/core/src/Frontend/FrontendServiceProvider.php +++ b/framework/core/src/Frontend/FrontendServiceProvider.php @@ -48,7 +48,7 @@ public function register(): void ); $assets->setLessImportDirs([ - $paths->vendor.'/components/font-awesome/less' => '' + $paths->vendor.'/components/font-awesome/css' => '' ]); $assets->css($this->addBaseCss(...));