Skip to content

Commit

Permalink
feat: fontawesome v6
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 committed Sep 19, 2024
1 parent f66a1b9 commit e136281
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion framework/core/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*",
Expand Down
9 changes: 4 additions & 5 deletions framework/core/less/common/Iconography.less
Original file line number Diff line number Diff line change
@@ -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";
7 changes: 6 additions & 1 deletion framework/core/src/Frontend/Compiler/LessCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions framework/core/src/Frontend/FrontendServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(...));
Expand Down Expand Up @@ -120,12 +120,12 @@ function (Container $container) {

return [
[
'href' => $filesystem->url('fonts/fa-solid-900.woff2'),
'href' => $filesystem->url('webfonts/fa-solid-900.woff2'),
'as' => 'font',
'type' => 'font/woff2',
'crossorigin' => ''
], [
'href' => $filesystem->url('fonts/fa-regular-400.woff2'),
'href' => $filesystem->url('webfonts/fa-regular-400.woff2'),
'as' => 'font',
'type' => 'font/woff2',
'crossorigin' => ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public function default_preloads_are_present()
$filesystem = $this->app()->getContainer()->make('filesystem')->disk('flarum-assets');

$urls = [
$filesystem->url('fonts/fa-solid-900.woff2'),
$filesystem->url('fonts/fa-regular-400.woff2'),
$filesystem->url('webfonts/fa-solid-900.woff2'),
$filesystem->url('webfonts/fa-regular-400.woff2'),
];

$body = $response->getBody()->getContents();
Expand Down

0 comments on commit e136281

Please sign in to comment.