Question regarding hikashop css and js

  • Posts: 938
  • Thank you received: 73
  • Hikashop Business
6 months 1 day 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: 65408
  • Thank you received: 9529
  • MODERATOR
6 months 22 hours 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: 938
  • Thank you received: 73
  • Hikashop Business
6 months 21 hours 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 months 2 weeks 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: 65408
  • Thank you received: 9529
  • MODERATOR
5 months 2 weeks 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 months 2 weeks 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: 938
  • Thank you received: 73
  • Hikashop Business
5 months 2 weeks 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: 65408
  • Thank you received: 9529
  • MODERATOR
5 months 2 weeks 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.

Time to create page: 0.075 seconds
Powered by Kunena Forum