? ? J4 Issue NPM Resource Changed ? Pending

User tests: Successful: Unsuccessful:

avatar drmenzelit
drmenzelit
27 Feb 2021

First step to make fontawesome available as web asset.
At the moment Cassiopeia delivers an own fontawesome.css file that is the result of importing fontawesome files from the media/vendor folder combined with the icomoon B/C mapping file (stored in media/system).
Since the fontawesome file can be also useful as a web asset in other parts of Joomla (e.g. frontend editing) or for 3rd party extensions / templates developers, it is better to have it in the media folder.

Summary of Changes

Removed fontawesome.scss from Cassiopeia.
Changed the joomla.asset.json in Cassiopeia to load fontawesome from media folder.
Added a joomla-fontawesome.scss file in media/system.

Testing Instructions

Apply the patch, run npm run build:css
Load the website using Cassiopeia as template.

Actual result BEFORE applying this Pull Request

Fontawesome icons are present (e.g. search symbol, chevron in readmore button). Fontawesome is loaded as templates/cassiopeia/css/vendor/fontawesome-free/fontawesome.min.css

Expected result AFTER applying this Pull Request

Fontawesome icons are still present. Fontawesome is loaded as media/system/css/joomla-fontawesome.min.css

Documentation Changes Required

avatar drmenzelit drmenzelit - open - 27 Feb 2021
avatar drmenzelit drmenzelit - change - 27 Feb 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 27 Feb 2021
Category Repository NPM Change Front End Templates (site)
avatar ChristineWk ChristineWk - test_item - 27 Feb 2021 - Tested successfully
avatar ChristineWk
ChristineWk - comment - 27 Feb 2021

I have tested this item successfully on 1b4894d


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32541.

avatar Fedik
Fedik - comment - 27 Feb 2021

It does no need, there already fontawesome asset, in media/vendor/joomla.asset.json
And a fix for font-face files in #31364

avatar Fedik
Fedik - comment - 27 Feb 2021

hm I have missed "icomoon" changes.
if someone need "icomoon" then ignore my previous comment ?

avatar brianteeman
brianteeman - comment - 27 Feb 2021

I would expect the fontawesome css to be the same just in a different location etc. But

image

avatar drmenzelit
drmenzelit - comment - 27 Feb 2021

It does no need, there already fontawesome asset, in media/vendor/joomla.asset.json
And a fix for font-face files in #31364

I didn't see your PR before I did mine... And I was not aware of fontawesome as an asset in the media/vendor/joomla.asset.json file :-(
As I understand the icomoon file contains a mapping old icomoon => new fontawesome. I think it is important to include.

avatar drmenzelit
drmenzelit - comment - 27 Feb 2021

@brianteeman the code in your screenshot is included in Autum but not in Cassiopeia
Because Autum loads also an own fontawesome file

avatar Fedik
Fedik - comment - 28 Feb 2021

I think here some confusion,
Cassiopeia already have templates/cassiopeia/scss/vendor/fontawesome-free/fontawesome.scss that holds fontawesome and icomoon.

And media/vendor/joomla.asset.json already holds fontawesome Asset.

The final file templates/cassiopeia/css/vendor/fontawesome-free/fontawesome.css overrides file from media/vendor/fontawesome-free/fontawesome.css, and so fontawesome Asset uses fontawesome.css provided by Cassiopeia.

All is working good already, you do not need to fix anything ?

avatar drmenzelit
drmenzelit - comment - 28 Feb 2021

I'm developing a J4 template without Bootstrap and with a parameter to switch fontawesome on / off. It works good. But if I want to use frontend editing, I need fontawesome (or I have to re-define the icons). I don't want to deliver an own version of fontawesome with the template (and Cassiopiea shouldn't do either), I want to load what Joomla already has in core. And I want to be able to load fontawesome only in component.php for the frontend editing. If the version of fontawesome in Joomla core doesn't include the font-face and the icons mapping, it will not work.

avatar brianteeman
brianteeman - comment - 28 Feb 2021

@Fedik The problem being solved is that a template might not use fontawesome but when you open an edit form on the front end then you will need to load fontawesome. So by making it available as an asset it can be added into the edit forms

When I write fontawesome I mean the fontawesome WITH iconmoon conversion file

avatar Fedik
Fedik - comment - 28 Feb 2021

So by making it available as an asset it can be added into the edit forms

As I already noted before: the fontawesome already provided by media/vendor/joomla.asset.json.
media/vendor/joomla.asset.json always loaded, and available for all extensions.

I'm developing a J4 template without Bootstrap and with a parameter to switch fontawesome on / off.

if you doing it in your personal template then all you need is something like:

if ($needToEnableFont) 
{
  $wa->useStyle('fontawesome');
}

If you want this in Cassiopiea, then you have to remove these dependencies from Cassiopiea joomla.asset.json:

"uri": "template.min.css",
"dependencies": [
"fontawesome"
]

"uri": "template-rtl.min.css",
"dependencies": [
"fontawesome"
]

And then use in PHP:

if ($needToEnableFont) 
{
  $wa->useStyle('fontawesome');
}
avatar Fedik
Fedik - comment - 28 Feb 2021

If the version of fontawesome in Joomla core doesn't include the font-face and the icons mapping, it will not work.

The fontawesome in Joomla core contains only original fontawesome style and icons, without mapping to Joomla icons.
These mapping done by the template itself (eg templates/cassiopeia/scss/vendor/fontawesome-free/fontawesome.scss).

If people want to have Joomla "icomoon" Independently from the template, then we probably need to re-compile fontawesome in media/vendor. But this is totally different topic.

avatar Fedik
Fedik - comment - 28 Feb 2021

hm, sorry, I think I am Turtle ?

I finally understood what you tries to do, it a bit in confusing way, but it is okay.

The PR is okay for its purpose.

Sorry again ?

avatar dgrammatiko
dgrammatiko - comment - 2 Mar 2021

Also, another comment here: ALL the fields should use SVG icons either as HTML or as css background so that the front end WILL BE font awesome free. Icon fonts are really deprecated and should be considered HARMFUL as their killing performance metrics but also have serious caveats for visually impaired people.

avatar drmenzelit drmenzelit - change - 2 Mar 2021
Labels Added: ? J4 Issue NPM Resource Changed ?
avatar brianteeman
brianteeman - comment - 2 Mar 2021

also have serious caveats for visually impaired people.

They are no better and no worse than svg. Its all down to how they are used.

avatar dgrammatiko
dgrammatiko - comment - 2 Mar 2021

They are no better and no worse than svg. Its all down to how they are used.

I suspect if everyone else dropped already font icons there are obvious drawbacks. Basically abusing Fonts for enhancing style was once an option (no SVG support in IE, etc) but those reasons have been eliminated since IE 11 which basically is like a decade ago. Time to move to something more in line with the actual web devs practices. My 2c anyways...

avatar brianteeman
brianteeman - comment - 2 Mar 2021

there are obvious drawbacks

I am only commenting on the repeated statement that they are not bad for accessibility or that SVG are good for accessibility

avatar dgrammatiko
dgrammatiko - comment - 2 Mar 2021

I am only commenting on the repeated statement that they are not bad for accessibility or that SVG are good for accessibility

SVG's (depending also on how you're using them) could be better one at least one case: if the network fails to deliver either the css or the actual font then the icons will not be displayed. Inlining (obviously cleverly, without blowing up the document size) eliminates this case. If you have the document you already have the icons ?. Anyways, there are more cases that fonts fall short for this particular usage but accessibility wise you can end up messing either. I never suggested that SVGs are by default accessible and icons are not but maybe the path to making something accessible could be easier with SVGs (purely because you will end up calling some PHP function that will do the right thing, instead of manually inserting HTML tags/attributes)

avatar Mrs-Jaydot
Mrs-Jaydot - comment - 20 Mar 2021

May I ask a question here?
I'm just a user, not a coder, but I don't know where else to ask.
I've made a test site with Beta8, and was happy to find FontAwesome installed locally.
However: I cannot use the brand icons (facebook, linkedin). Miscellaneous icons (bicycle, camera) display just fine.
Is there a reason for this?
Thanks.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32541.

avatar sandramay0905
sandramay0905 - comment - 20 Mar 2021
avatar Mrs-Jaydot
Mrs-Jaydot - comment - 20 Mar 2021

@sandramay0905 Thanks, I know, but no-one there has any idea. The only answer I got was "I don't think Joomla uses Font Awesome...".

avatar drmenzelit
drmenzelit - comment - 20 Mar 2021

@sandramay0905 Thanks, I know, but no-one there has any idea. The only answer I got was "I don't think Joomla uses Font Awesome...".

Are you using Cassiopeia or an own template?

avatar Mrs-Jaydot
Mrs-Jaydot - comment - 20 Mar 2021

@drmenzelit Cassiopeia.

avatar brianteeman
brianteeman - comment - 20 Mar 2021

There are multiple font files for fontawesome. Not all are free etc

avatar drmenzelit
drmenzelit - comment - 20 Mar 2021

@drmenzelit Cassiopeia.

<i class="fab fa-facebook"></i> should work (fab is for brands)

avatar dgrammatiko
dgrammatiko - comment - 20 Mar 2021

brands need a fab class, eg <i class="fab fa-facebook-f"></i>
fab === brands
far === regurlar
fas === solid

In short there are 3 fonts and if you load all of them your site will be blank for some time for first-time visitors...

avatar Mrs-Jaydot
Mrs-Jaydot - comment - 20 Mar 2021

@brianteeman I know, but FA4 is free for download, and it contains brand icons.
@drmenzelit Thank you!! Works! I didn't know about the faB.
@Fedik Thank you for responding and explaining, I didn't know it worked that way.
Many thanks to all of you.
I will now move back to forum.org, where I belong :).

avatar RickR2H
RickR2H - comment - 28 Jul 2021

Do we have to test this patch?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32541.

avatar richard67
richard67 - comment - 28 Jul 2021

Do we have to test this patch?

@RickR2H In general yes, every PR needs 2 tests, but is currently has a conflict in file templates/cassiopeia/scss/vendor/fontawesome-free/fontawesome.scss, so better wait until that has been resolved.

@drmenzelit Is the PR still relevant? If yes, could you solve the conflict? Let me know if you need help with that. Thanks in advance.

avatar drmenzelit
drmenzelit - comment - 28 Jul 2021

The discussion was long, I got lost at some point... and it seems my approach is not clear for everyone, so I think it is up to @wilsonge to decide what to do with it

avatar richard67 richard67 - change - 8 Aug 2021
Labels Added: ? ?
Removed: ? ?
avatar richard67
richard67 - comment - 8 Aug 2021

@ChristineWk Could you test again with the new packages for this PR? Thanks in advance.

avatar brianteeman brianteeman - test_item - 8 Aug 2021 - Tested successfully
avatar brianteeman
brianteeman - comment - 8 Aug 2021

I have tested this item successfully on 5b1a08d

works as described


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32541.

avatar ChristineWk ChristineWk - test_item - 8 Aug 2021 - Tested successfully
avatar ChristineWk
ChristineWk - comment - 8 Aug 2021

I have tested this item successfully on 5b1a08d

Hv this (if it's OK):
/*!

avatar richard67 richard67 - change - 8 Aug 2021
Status Pending Ready to Commit
avatar richard67
richard67 - comment - 8 Aug 2021

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32541.

avatar N6REJ
N6REJ - comment - 8 Aug 2021

we created a auto .fa to .iconmoon conversion system long ago. idky it needs to be done in another way yet again.

avatar richard67
richard67 - comment - 8 Aug 2021

we created a auto .fa to .iconmoon conversion system long ago. idky it needs to be done in another way yet again.

@N6REJ This PR here doesn't change anything on the mapping, it just moves scss to another place and makes it available as template-independent asset.

avatar brianteeman
brianteeman - comment - 8 Aug 2021

Its not being done in a different way its just putting the files in the correct place

avatar richard67
richard67 - comment - 8 Aug 2021

Its not being done in a different way its just putting the files in the correct place

That's what I've said, too.

avatar brianteeman
brianteeman - comment - 8 Aug 2021

github cache sucks sometimes

avatar N6REJ
N6REJ - comment - 9 Aug 2021

Thanks guys, I was about to say, danggggg after all that work LOL

avatar wilsonge wilsonge - change - 9 Aug 2021
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2021-08-09 10:47:36
Closed_By wilsonge
Labels Added: ? ?
Removed: ?
avatar wilsonge wilsonge - close - 9 Aug 2021
avatar wilsonge wilsonge - merge - 9 Aug 2021
avatar wilsonge
wilsonge - comment - 9 Aug 2021

Thanks!

Add a Comment

Login with GitHub to post a comment