Sackgesicht VIP
Total posts: 1,636
25 May 2013 18:15

I just remembered a helpful undocumented Cobalt feature - The custom.css file.

Cobalt supports a custom.css in

/components/com_cobalt/library/css

and loads it.

Last Modified: 02 Mar 2014


Guest
26 May 2013 04:09

about css... what do you think it's better in terms of site performance

create separate css files for each template (so that the css get loaded only when a certain template/page is visited)

or put all the css in the template css file (or as an alternative in the custom css file you are talking about)?

this last option would be obviously better in terms of managing all those css rules, as they will be all in the same place, but I am not sure if it would help also in terms of site performance


Sackgesicht VIP
Total posts: 1,636
26 May 2013 05:09

It depends ...

I will give an example.

I use a custom output template for the uploads field to display a PDF icon with the number of attached documents behind.

Initially the css code for this was included in the output template via a tag.

Including some compatibility code it is around 1K. Now depending on some settings there can be 4 of these output fields per record. If i will display 25 records per page, this will already add 100K (25 x 4 fields) to my page code, since it is repeated for every uploads field display.

Now it would be much better to add it to the list template code, so that it would be adding only 1K instead of the wasted 100k loading time/ bandwith consumption.

Since i use the same code also in an article display template, i thought to add it to the Joomla template code, but the disadvantage here would be the testing with other templates. So a much better place is the Cobalt custom.css file. 1

Nowadays most Joomla websites use an "accelerator" plugin like Rokbooster etc or a CDN service which takes care of merging the css and/or js files to increase performance and reduce the http requests. Then it would not make a difference anymore.

If you are looking for better performance and more control of unnecessary loaded files, then i would suggest to look into JCC.


Guest
26 May 2013 05:16

Thank for the explanation :)

Initially the css code for this was included in the output template via a tag.

Including some compatibility code it is around 1K. Now depending on some settings there can be 4 of these output fields per record. If i will display 25 records per page, this will already add 100K (25 x 4 fields) to my page code, since it is repeated for every uploads field display.

I didn't thought about this... while it's so obvious :O

currently I am using ouput templates to float:left record list images, as I noticed that setting a class in the image field does work only for full record view...

I guess setting a css class in the field parameters shoud work for list view too... or am I missing something

Powered by Cobalt