-
Notifications
You must be signed in to change notification settings - Fork 1
/
extend.php
60 lines (49 loc) · 1.75 KB
/
extend.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/*
* This file is part of blomstra/fontawesome.
*
* Copyright (c) 2022 Blomstra Ltd.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*
*/
namespace Blomstra\FontAwesome;
use Blomstra\FontAwesome\Content\Frontend;
use Blomstra\FontAwesome\Providers\FontAwesomeLessImports;
use Blomstra\FontAwesome\Providers\FontAwesomePreloads;
use Flarum\Extend;
use Illuminate\Contracts\Filesystem\Cloud;
use Illuminate\Contracts\Filesystem\Factory;
return [
(new Extend\Frontend('forum'))
->css(__DIR__.'/less/forum.less')
->css(__DIR__.'/less/common.less')
->content(Frontend::class),
(new Extend\Frontend('admin'))
->js(__DIR__.'/js/dist/admin.js')
->css(__DIR__.'/less/admin.less')
->css(__DIR__.'/less/common.less')
->content(Frontend::class),
new Extend\Locales(__DIR__.'/locale'),
(new Extend\ServiceProvider())
->register(FontAwesomePreloads::class)
->register(FontAwesomeLessImports::class),
(new Extend\Settings())
->default('blomstra-fontawesome.kitUrl', '')
->default('blomstra-fontawesome.type', 'free'),
(new Extend\Theme())
->addCustomLessFunction('blomstra-fontawesome-font-urls', function ($style) {
/**
* @var Cloud
*/
$disk = resolve(Factory::class)->disk('flarum-assets');
$uri = $disk->url('extensions/blomstra-fontawesome/fontawesome-6-free/fa-'.$style);
if ($style === 'solid') {
$uri .= '-900';
} else {
$uri .= '-400';
}
return "url('$uri.woff2') format('woff2'), url('$uri.ttf') format('truetype')";
})
];