create a new template using the Web Assets
$wa = $this->getWebAssetManager();
$wa->useStyle('template.test.ltr');
in the joomla.asset.json file
"assets": [
{
"name": "template.test.ltr",
"type": "style",
"uri": "template.css",
"dependencies": [
"fontawesome"
]
},
to load the library Fontawesome from the joomla core
load the media/vendor/fontawesome-free/css/fontawesome.min.css file, but the @font-face is missing
no FA icon is working in the page, because the font is not declared
@font-face{font-family:Font Awesome\ 5 Free; ... also for the Brand
in Cassopeia, the font-face is included in the template.min.css file, but if we load FA from the core, it shall be loaded correctly also with the font-face. Else we shall declare the font-face each time, for each template/extension and this is not correct
4.0.0 beta 4
but if we load FA from the core, it shall be loaded correctly also with the font-face. Else we shall declare the font-face each time, for each template/extension and this is not correct
I agree. Joomla has the webfonts packed. Therefore their should be additional CSS that can be used as additional dependencies to decide which fonts to load (or not load) from /media/ folder.
This is happening because they (fa ) expect you to load the fontset yourself.
may be but in joomla asset there is 1 dependency, "fontawesome". It shall call all the needed CSS to make it work. Not only a part of it ...
as per the FA doc, you must copy and load the 3 files to make it work. They don't say to load only one file
Having tested #31096 today during Pizza Bugs & Fun, I've suggested whether @N6REJ should look at how to implement this in Cassiopeia, which would then give an example for template developers to use it in Joomla 4.
Or is this just something to document for developers/implementers to be aware of that FontAwesome is now included in Joomla 4 and you can access the files locally from the atum admin template (end solution may see them need to be moved from atum template to a library location and be called from there?)
when you use the Web Assets Manager to load the depency "fontawesome", it is supposed to load it. Else what is the goal of it ?
This is loaded as joomla library, to avoid to load your own files yourself.
May be that there shall be few options like
"dependencies": ["fontawesome-all"]
"dependencies": ["fontawesome-regular"]
"dependencies": ["fontawesome-solid"]
...
this way we could load only the needed one as you suggested
I guess should be used
node_modules/@fortawesome/fontawesome-free/css/all.css
instead of
node_modules/@fortawesome/fontawesome-free/css/fontawesome.css
need to update build stuff,
I will check some time later
what do you mean?
since, for example, com_content & mod_login, use fa icons wouldn't FA be automatically available for the template too?
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-11-08 10:28:52 |
Closed_By | ⇒ | richard67 |
thanks for reporting this.
This is happening because they (fa ) expect you to load the fontset yourself.