NPM Resource Changed ? ? Pending

User tests: Successful: Unsuccessful:

avatar dgrammatiko
dgrammatiko
29 Aug 2019

Pull Request for Issue # .

Joomla has a very well established pattern for overridding CSS and JS assets. You place the override file in the template specific folder and magic happens.

For some reason, instead of promoting modularity and the core functionality we end up making the css of the template a huge garbage bin, where anyone can append some css.

This should stop as the produced css is not maintainable and is spaggetti code that nobody could figure out where could be the source of a bug (cascading is already hard let's not make it even harder). Not to mention that performance also has a negative impact but that's minor in this case...

Summary of Changes

All the files that are loaded through an HTMLHelper should NOT be overridden with code internally to the template. This PR reverts it for the following external resources (vendor folder):

  • awesomplete
  • choicesjs
  • font awesome
  • minicolors
  • joomla-alert
  • joomla-tab

Testing Instructions

Check if anything is broken in the backend
(it shouldn't be as I'm still importing the original css, I know but then this PR is becoming a major refactor...)

Expected result

Actual result

Documentation Changes Required

PS there should be some QA for the scss of the template, the code is nowhere near beta state, just saying

482aea2 29 Aug 2019 avatar dgrammatiko fixit
avatar dgrammatiko dgrammatiko - open - 29 Aug 2019
avatar dgrammatiko dgrammatiko - change - 29 Aug 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 29 Aug 2019
Category Administration Templates (admin) JavaScript Repository
avatar dgrammatiko dgrammatiko - change - 29 Aug 2019
Labels Added: ?
e04f184 29 Aug 2019 avatar dgrammatiko errr
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 2 Sep 2019

Please resolve conflicting files so this PR can get tested at Worldwide Pizza, Bugs & Fun, October 19th

avatar dgrammatiko dgrammatiko - change - 2 Sep 2019
Labels Added: Conflicting Files
avatar dgrammatiko dgrammatiko - change - 2 Sep 2019
The description was changed
avatar dgrammatiko dgrammatiko - edited - 2 Sep 2019
avatar dgrammatiko dgrammatiko - change - 8 Oct 2019
Labels Removed: Conflicting Files
avatar Quy
Quy - comment - 8 Oct 2019

FontAwesome icons don't appear.

26077

avatar dgrammatiko
dgrammatiko - comment - 9 Oct 2019

@Quy do you have the css file administrator/templates/atum/css/vendor/fontawesome-free/fontawesome.min.css ? If so do you also get the actual font?

avatar Quy
Quy - comment - 9 Oct 2019

Installed your branch. There is no vendor directory.

avatar C-Lodder
C-Lodder - comment - 9 Oct 2019

@Quy Did you run npm i?

avatar Quy
Quy - comment - 9 Oct 2019

Yes, both npm i and npm ci. Still no go.

avatar dgrammatiko
dgrammatiko - comment - 9 Oct 2019

@Quy what's your OS?

avatar Quy
Quy - comment - 9 Oct 2019

Testing locally with XAMPP on Windows 10 Home.

avatar dgrammatiko
dgrammatiko - comment - 9 Oct 2019

@Quy thanks, I'll check why the build tools are failing to generate the css for winDOS

avatar dgrammatiko
dgrammatiko - comment - 17 Oct 2019

@Quy can you give it another try?

avatar Quy
Quy - comment - 17 Oct 2019

Almost there. Here are a few more that don't appear.

26077a
26077b

avatar dgrammatiko
dgrammatiko - comment - 17 Oct 2019

@Quy thank you, should fine now

avatar Quy
Quy - comment - 17 Oct 2019

They show up but don't display properly.

26077c

4b47e1d 17 Oct 2019 avatar dgrammatiko path
5dff363 17 Oct 2019 avatar dgrammatiko oops
avatar Quy
Quy - comment - 17 Oct 2019

It is still an issue. Please let me know when to test again. Thanks.

avatar dgrammatiko
dgrammatiko - comment - 17 Oct 2019

Did you run npm I and cleaned the browser cache? Works fine here...

avatar Quy
Quy - comment - 17 Oct 2019

Yes. Some display correctly and others don't.

26077d

avatar dgrammatiko
dgrammatiko - comment - 17 Oct 2019

what's your browser?

avatar Quy
Quy - comment - 17 Oct 2019

Tested with Firefox 69.0.3 and Chrome 77.0.3865.120. Icons with class icon- don't display properly.

avatar ciar4n
ciar4n - comment - 17 Oct 2019

@dgrammatiko

FontAwesome 5 now requires a font-weight of 900 on the pseudo class. Try adding the following to the start of the _icons.scss ...

[class*=" icon-"]::before,
[class^="icon-"]::before,
.btn::after {
  font-weight: 900;
}
avatar Quy
Quy - comment - 18 Oct 2019

@ciar4n It did the trick. A few more then we should be good.

26077login

26077help

avatar infograf768
infograf768 - comment - 18 Oct 2019

hmm
I can't get npm ci to work here

Internal Error: File to read not found or unreadable: /Applications/MAMP/htdocs/newfolder/joomla40/administrator/templates/atum/scss/vendor/minicolors/minicolors.scss

sh: line 1: 25356 Segmentation fault: 11  node build.js --compile-css

If I redo, then I get

Internal Error: File to read not found or unreadable: /Applications/MAMP/htdocs/newfolder/joomla40/administrator/templates/atum/scss/vendor/choicesjs/choicesjs.scss

sh: line 1: 25484 Segmentation fault: 11  node build.js --compile-css
avatar joomla-cms-bot joomla-cms-bot - change - 19 Oct 2019
Category Administration Templates (admin) JavaScript Repository Administration Templates (admin) JavaScript Repository NPM Change
avatar nadjak77
nadjak77 - comment - 19 Oct 2019

After applying patch and run npm i some icons are missing:
image
image

avatar nadjak77 nadjak77 - test_item - 19 Oct 2019 - Tested unsuccessfully
avatar nadjak77
nadjak77 - comment - 19 Oct 2019

I have tested this item ? unsuccessfully on 0afab17

apply patch
run npm i
some icons are missing


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

avatar dgrammatiko
dgrammatiko - comment - 19 Oct 2019

@nadjak77 can you create a gist with the font awesome css?

avatar dgrammatiko dgrammatiko - change - 19 Oct 2019
Labels Added: NPM Resource Changed
avatar nadjak77
nadjak77 - comment - 19 Oct 2019

I hope this is the right file you want to see:
https://gist.github.com/nadjak77/cc199b47dc8309c16341a3776c817048
this is the template.css with your patch

avatar dgrammatiko
dgrammatiko - comment - 19 Oct 2019

@nadjak77 thanks, but I was referring to the actually css for font awesome. Anyways I think I figure out what was missing here

avatar Quy Quy - test_item - 20 Oct 2019 - Tested successfully
avatar Quy
Quy - comment - 20 Oct 2019

I have tested this item successfully on bfd6ffe


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

avatar SharkyKZ SharkyKZ - test_item - 21 Oct 2019 - Tested successfully
avatar SharkyKZ
SharkyKZ - comment - 21 Oct 2019

I have tested this item successfully on bfd6ffe


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

avatar SharkyKZ SharkyKZ - change - 21 Oct 2019
Status Pending Ready to Commit
avatar SharkyKZ
SharkyKZ - comment - 21 Oct 2019

RTC


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

avatar infograf768 infograf768 - change - 21 Oct 2019
Labels Added: ?
avatar SharkyKZ SharkyKZ - test_item - 21 Oct 2019 - Tested unsuccessfully
avatar SharkyKZ
SharkyKZ - comment - 21 Oct 2019

I have tested this item ? unsuccessfully on df4929f


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

avatar SharkyKZ
SharkyKZ - comment - 21 Oct 2019

I have tested this item ? unsuccessfully on df4929f


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

avatar SharkyKZ SharkyKZ - change - 21 Oct 2019
Status Ready to Commit Pending
avatar SharkyKZ
SharkyKZ - comment - 21 Oct 2019

Some choicesjs field styling is missing:
Untitled

avatar dgrammatiko dgrammatiko - change - 21 Oct 2019
Labels Removed: ?
avatar dgrammatiko
dgrammatiko - comment - 21 Oct 2019

@SharkyKZ bandaid applied.
@wilsonge please check the assets code, they seem to ignore the overrides. Was that intentional?

avatar SharkyKZ
SharkyKZ - comment - 22 Oct 2019

Styling is still a little broken
Screenshot_2019-10-22 Articles Edit - Joomla - Administration

avatar SharkyKZ
SharkyKZ - comment - 22 Oct 2019

About asset issues you'll have to ask @Fedik.

avatar Fedik
Fedik - comment - 22 Oct 2019

@wilsonge please check the assets code, they seem to ignore the overrides. Was that intentional?

need more details, what exactly problem,
what you do and what you get?

avatar dgrammatiko
dgrammatiko - comment - 22 Oct 2019

need more details, what exactly problem
what you do and what you get?

@Fedik should be easy to replicate:
using the 4.0-Dev branch, In the atum/css folder create create a folder vendor/fontawesome-free. In this newly created folder create a css file named font awesome.css with some dummy content. The expected behavior is that the newly created css should be delivered instead of the media/vendor/fontawesome-free/...
But it isn’t

avatar Fedik
Fedik - comment - 22 Oct 2019

All libs from /media/vendor has strict path in its own asset, see /media/vendor/joomla.asset.json

{
      "package": "@fortawesome/fontawesome-free",
      "name": "fontawesome-free",
      "version": "5.9.0",
      "css": [
        "media/vendor/fontawesome-free/css/fontawesome.min.css"
    ]
},

(btw it should be "name": "fontawesome",)

It can be overridden by overriding the asset.
that why you had:

{
      "name": "fontawesome",
      "css": [
        "fontawesome.min.css"
      ]
}

in the template. This override asset "fontawesome" to use another file(s).

avatar SharkyKZ
SharkyKZ - comment - 27 Oct 2019

There are still two instances of choices.css loaded.

avatar dgrammatiko
dgrammatiko - comment - 27 Oct 2019

There are still two instances of choices.css loaded.

I know! The problem is that the original is loaded with webAssets, that for some reason doesn't pick up the override. If I try to override the css then the JS ends up not loading. I think @Fedik already has a PR that gives more granular access but till that PR is merged the original (from media) css file is also loaded here.

avatar Fedik
Fedik - comment - 28 Oct 2019

well, it sounds like it better to allow to override vendor files in "old way" also, for j4
I try to update that PR some time later, or I will do another one, will see

avatar dgrammatiko
dgrammatiko - comment - 3 Nov 2019

@wilsonge is there any interest on this one or should I move on?

avatar SharkyKZ SharkyKZ - test_item - 6 Nov 2019 - Tested successfully
avatar SharkyKZ
SharkyKZ - comment - 6 Nov 2019

I have tested this item successfully on ab05717


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

avatar SharkyKZ
SharkyKZ - comment - 6 Nov 2019

I have tested this item successfully on ab05717


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

avatar Quy Quy - test_item - 8 Nov 2019 - Tested successfully
avatar Quy
Quy - comment - 8 Nov 2019

I have tested this item successfully on ab05717


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

avatar Quy Quy - change - 8 Nov 2019
Status Pending Ready to Commit
avatar Quy
Quy - comment - 8 Nov 2019

RTC


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

avatar infograf768 infograf768 - change - 16 Nov 2019
Labels Added: ?
avatar wilsonge wilsonge - change - 30 Nov 2019
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2019-11-30 21:41:13
Closed_By wilsonge
avatar wilsonge
wilsonge - comment - 30 Nov 2019

Thanks!

avatar infograf768
infograf768 - comment - 1 Dec 2019

@dgrammatiko
Looks like atum specific choice.css is not loaded in com_associations.
Screen Shot 2019-12-01 at 17 02 26

avatar dgrammatiko
dgrammatiko - comment - 1 Dec 2019

@infograf768 are the tags ok in that page?

avatar infograf768
infograf768 - comment - 1 Dec 2019

Same.

Screen Shot 2019-12-01 at 17 44 54

avatar dgrammatiko
dgrammatiko - comment - 1 Dec 2019

@infograf768 in the atum/component.php
add
after line 17

$wa    = $this->getWebAssetManager();

and after line 30


// Enable assets
$wa->enableAsset('template.atum.' . ($this->direction === 'rtl' ? 'rtl' : 'ltr'));
$wa->enableAsset('fontawesome-free');

// TODO: remove the following line whenever the assets are fixed to respect the ovverides
HTMLHelper::_('stylesheet', 'vendor/choicesjs/choices.css', array('version' => 'auto', 'relative' => true));

On a more serious note the assets for the iframes need some attention (eg the component.php needs to reflect the index.php)

avatar dgrammatiko
dgrammatiko - comment - 1 Dec 2019
avatar Fedik
Fedik - comment - 1 Dec 2019

$wa->enableAsset('fontawesome-free');

all you need:

$wa->enableAsset('fontawesome-free')->enableAsset('choices');
avatar dgrammatiko
dgrammatiko - comment - 1 Dec 2019

@Fedik this didn't work as it expects me to override both the css and the javascript. I wanted only the css from the choices to be overriden

Add a Comment

Login with GitHub to post a comment