Question regarding hikashop css and js

  • Posts: 1119
  • Thank you received: 114
5 years 5 months ago #299429

Hi,

1. We have updated to hikashop 4 and it looks great with font awesome and so on. However i am not sure to understand why you have created seperate css file for font awesome?

My concern is that hikashop loads like 10 files (css and js) which basically could be added into 1 or 2.
Same issue with Joomla it self and any other component/module/plugin who has no option to disable they js or css...

As example, hikashop has hikashop.css file but as for us we don't need that file at all because we use css per template and bootstrap 3. We also use fontello, we have generated our font with only 15 icons and we don't need full font awesome...So it's extra requests...
I understand that some part of code must be, especially for users who have less knowledge and happy to install anything and use it without any doubts regarding performance....

2. Similar question to chosen.css and vex.css Why they are not in hikashop.css as example?

You may ask why we not use plugins like JCH Optimize? Well because we get much better performance when we do it manually in one file and minify it....

3. Would be good if hikashop could consider to add some extra params where we could just disable or enable files like hikashop.css

Kind Regards

Please Log in or Create an account to join the conversation.

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
5 years 5 months ago #299439

Hi,

1. Fontawesome is its own library which publish updates. If we want to update fontawesome, it's better that it sits separately from HikaShop. Also, HikaShop has a hidden option to be able to deactivate the fontawesome CSS of HikaShop so that if your template already has fontawesome, you don't even up with the CSS twice on your pages for nothing. There is also a hidden option to be able to load the fontawesome CSS from the CDN provided by fontawesome. In that case, most of your users will probably already have fontawesome cached by their browser when they loaded other pages from other websites. That way, their won't be any loading necessary for them for that CSS code and thus it's even lighter than having it together with something else already included.

2. chosen.css is not a file of HikaShop, it's a file from Joomla.
Vex, as fontawesome is its own library which also publish updates so we prefer to have it separately.

It's a bit like the PHP. We could technically have all the code of HikaShop into one big PHP file. That way, PHP wouldn't have to load hundreds of PHP files each time it has to render a page (and each read from the hard drive is quite slow while doing one big read is quite efficient). But we don't do that (and no one sane PHP developer does that).
First, it's just impossible to maintain in the long term. When your file start to go over a few thousand lines, it's a pain to read it and maintain it. I personally already have a hard time to keep track of the different parts of the CSS files because there is no easy way to go through the code like there is with PHP so that you can just pick a function and the editor goes at the correct place in the file. So I don't want to imagine having only one big file.
Second, not all the CSS or JS applies to everywhere. hikashop.css for example is for the main structural CSS of HikaShop which is used in both front and backend. Then you have the frontend_default.css for the basic styling on the frontend and backend_default.css for the basic styling on the backend. If we wanted to remove hikashop.css we would have its code in both frontend and backend CSS files and thus we would have to duplicate the changes we have to make to it each time. Or we would have only one file with a bunch of CSS that is never used in the frontend loaded all the time, just because.
For example, the tooltip.css is used sparsely on the frontend in a few places. We would have to load it all the time while in 90% of the cases, it doesn't make sense.
Like in PHP, it makes much more sense to have many files and have some automatic tool to load all that and compress it on the fly. And since usually you would have similar issues with other extensions and templates it's a lot better to have one tool to handle all the files of the website rather than us doing something for just our own files.

3. We do have some hidden settings that can be used to disable some things. But for some, like hikashop.css we don't really want to allow people to disable it because then, when they update, they come to us to complain that they are missing some bits of the interface because they didn't update the CSS on their end (or their template didn't update the CSS on their end) and we end up working for things that shouldn't be ours to handle.
Now if you really want to do your custom thing because you know what you're doing, just write a small system plugin implementing the onBeforeCompileHead trigger of Joomla and you can dynamically change / remove / add the CSS and JS files you want regardless of what we do in HikaShop, and it's the same with any other extension.

Please Log in or Create an account to join the conversation.

  • Posts: 1119
  • Thank you received: 114
5 years 5 months ago #299453

Hi.


Thanks for taking your time to answer this topic. I didn't know about that Joomla trigger. Thanks

Kind regards

Please Log in or Create an account to join the conversation.

  • Posts: 117
  • Thank you received: 6
5 years 5 months ago #300023

nicolas wrote: Also, HikaShop has a hidden option to be able to deactivate the fontawesome CSS of HikaShop so that if your template already has fontawesome, you don't even up with the CSS twice on your pages for nothing.


Hi Nicolas, tell me please where is that option and how to change it?


Sorry for my English, it's not my native language.

Please Log in or Create an account to join the conversation.

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
5 years 5 months ago #300026

Hi,

You will need to open the hikashop_config table via your phpmyadmin and add in that table an entry with the namekey font-awesome and the value "no" and that will remove the loading of the font-awesome library.

The following user(s) said Thank You: alin

Please Log in or Create an account to join the conversation.

  • Posts: 117
  • Thank you received: 6
5 years 5 months ago #300044

Thanks!


Sorry for my English, it's not my native language.

Please Log in or Create an account to join the conversation.

  • Posts: 1119
  • Thank you received: 114
5 years 5 months ago #300045

Hi,

Hmm, won't this remove font-awesome from back-end too?

Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
5 years 5 months ago #300047

Hi,

Yes, it will. Note that Joomla 4 already loads automatically font-awesome on the backend. For joomla 3, you would have to add the font awesome CSS file to your joomlate backend template.

Please Log in or Create an account to join the conversation.

  • Posts: 228
  • Thank you received: 4
  • Hikashop Business
3 years 9 months ago #321255

Hi I'm trying to also stop Font Awesome from loading as part of HikaShop as it's loaded by my template.

I've tried looking in the database table as suggested but cannot see a font awesome or similar field.

Simply renaming the file is not good for the reason suggested as any update will just reactivate it, but it then also shows an an error in the Dev console as a missing file, not sure that a good thing!

Can it be logged as a feature request to have a setting with the configuration to select wether to load FontAwesome as we have currently with Bootstrap? This way future updates will not be affected.

In the meantime where in the 4.3.x release is the settings to load Font Awesome so it can be over ridden. I can add a specicif URL to my admin template code to keep it loading on the backend.

Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
3 years 9 months ago #321261

Hi,

In your database, in the hikashop_config table, you have three columns, config_namekey, config_value and config_default.
And for each entry of that table, you have one value for each column, a cell.
You won't have any cell with any font-awesome related text. That's why in my message 1 year ago I said that you need to add an entry to that table, not to edit one.
So you need to add an entry with the namekey "font-awesome-type" and the value "admin" and font-awesome will only be loaded on the backend (as it is needed in the backend for the HikaShop icons).

Updates won't be a problem since the updates won't change that value of the config table.

The following user(s) said Thank You: n00bster

Please Log in or Create an account to join the conversation.

  • Posts: 278
  • Thank you received: 14
  • Hikashop Business
3 years 4 months ago #327357

Just one note on that topic.
I think you are far to early add fontawesome 5 in Hikashop. Most of the template devs added version 5 in their templates this year (or maybe previous). But vast number of shops are made years befor. So we all (most of us) have fontawesome 4 and boostrap 2 and 3.

Please Log in or Create an account to join the conversation.

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
3 years 4 months ago #327360

Hi,

We actually had fontawesome 4 before and got some incompatibilities with templates with fontawesome 5, motivating us to move to the newer version last year. Also, Joomla 4 comes with fontawesome 5 and a first stable version of Joomla 4 is soon to be released.
I don't see a perfect solution here. I believe that what we have (using fontawesome 5 and having the possibility to not use it) so that we can fallback to the fontawesome 4 of the template) is the less bad solution.

Please Log in or Create an account to join the conversation.

Time to create page: 0.112 seconds
Powered by Kunena Forum