Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Group all CSS into one file

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 03-14-2017, 03:02 AM
 
xgarb xgarb is online now
 

eXpert
  
Join Date: Jul 2004
Location: UK
Posts: 263
 

Default Group all CSS into one file

I'm trying to reduce the number of requests the site is making. One possible idea is to make one CSS file that is used for every page. It might be a little more data than the current system of serving CSS based on the page but once it's cached then it won't be a problem.

I've also noticed this in one of the page speed testers...

Resources with a "?" in the URL are not cached by some proxy caching servers. Remove the query string and encode the parameters into the URL for the following resources:

One inelegant solution is to scan the site for all the CSS files, remove the ones that are from modules that aren't used. Minify them all and then include in the template as a static CSS file.

Anyone have a better plan?
__________________
Core version: 5.5.xx
Reply With Quote

The following user thanks xgarb for this useful post:
Triple A Racing (03-14-2017)
  #2  
Old 03-14-2017, 10:19 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Group all CSS into one file

Is the "Aggregate CSS files" setting enabled in your store? It is supposed to do what you describe:
http://kb.x-cart.com/en/setting_up_x-cart_5_environment/speeding_up_your_store.html#step-1-enable-css-js-a...widget-caching
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #3  
Old 03-15-2017, 01:27 AM
 
xgarb xgarb is online now
 

eXpert
  
Join Date: Jul 2004
Location: UK
Posts: 263
 

Default Re: Group all CSS into one file

Quote:
Originally Posted by qualiteam
Is the "Aggregate CSS files" setting enabled in your store? It is supposed to do what you describe:

Sort of does it, but check out the number of files..

<link href="http://firemouth.co.uk/xcart5test/var/resources/css/http/all/5b0fe15624457dd1ac0b7dab2e733879df8f679c2915c293d6 ec30a9679d409b.css?1487706193" rel="stylesheet" type="text/css" media="all" />
<link href="http://firemouth.co.uk/xcart5test/var/resources/default/http/screen/892dc82e328e0c690b100ea39235394f.css?1487706193" rel="stylesheet" type="text/css" media="screen" />
<link href="http://firemouth.co.uk/xcart5test/var/resources/default/http/screen/4e0530c04002109470a4b7631f9a73e6.css?1487706193" rel="stylesheet" type="text/css" media="screen" />
<link href="http://firemouth.co.uk/xcart5test/var/resources/css/http/all/b0c695f19851c08dfee36612b817433aee44091c724005b800 bbc6be263bf622.css?1487706193" rel="stylesheet" type="text/css" media="all" />
<link href="http://firemouth.co.uk/xcart5test/var/resources/css/http/print/1ec3db6a62c0d145e11d908cad5e8d68368fb1f59a645ffea3 edbe7144cb5932.css?1487706193" rel="stylesheet" type="text/css" media="print" />

Ideally there should be two. One for 'all' and one for 'print'. The other problem is there is multiple CSS files on the server which I'm guessing is for different page types (category, product etc) which is a clever system but ultimately I believe makes the site slower as each page the user visits has potentially a new stylesheet or two.
__________________
Core version: 5.5.xx
Reply With Quote
  #4  
Old 03-15-2017, 04:10 AM
 
Daemos Daemos is offline
Advanced Staff Users
 

X-Cart team
  
Join Date: Nov 2015
Posts: 7
 

Default Re: Group all CSS into one file

Quote:
which is a clever system but ultimately I believe makes the site slower as each page the user visits has potentially a new stylesheet or two.

It is definitely true in general but there are always some limitations.

In fact, typical X-Cart theme css content is very large (even aggregated and minified) to download and the most part of it would be redundant on some specific page.

That is why X-Cart splits all css which is needed to display the page in two parts - one part is common for any page, and second is related to this specific page.

Such system allows to cache the common part and download only the smaller, dynamic part, so that's no different from single site stylesheet.
__________________
Eugene Dementjev
XC5 Developer
Reply With Quote
  #5  
Old 03-15-2017, 05:13 AM
 
Triple A Racing Triple A Racing is offline
 

X-Wizard
  
Join Date: Jul 2008
Location: Manchester UK
Posts: 1,028
 

Default Re: Group all CSS into one file

We always have used "Aggregate CSS files" and it does help but nothing is ever perfect as X-Cart often use Google as a yardstick (!) We've said previously that we're not big fans of Google, but their Page Speed tests do show some of these issues in more detail, albeit 'above the fold' related issues, which also differ between Desktop and Mobile devices...

On our Dev Store, we're reasonably close to solving it. Only 1 CSS issue (Optimize CSS Delivery) left on the Desktop test but 5 CSS issues (Optimize CSS Delivery) and 1 JS issue (Remove render-blocking JavaScript) still left on the Mobile test It would show some great XC5 product design awareness skills, if these scores were the other way around, as Mobile surpassed Desktop as a top purchase device some time ago (in the UK anyway).

We'll carry out the same changes to our live store so that's up to speed too, but may wait until XC 5.3.3, because we don't want to do everything twice!
__________________
Dev Store & Live Store XC Business 5.4.1.35
Server; Ubuntu 22.04.2 LTS (HWE 6.2.0.26.26 Kernel)) / Plesk Obsidian
Nginx 1.20.4 / Apache 2.4.52 (Ubuntu Backported) / MariaDB 10.11.4 / PHP 7.4.33
Reply With Quote
  #6  
Old 03-16-2017, 12:49 AM
 
ITVV ITVV is online now
 

X-Wizard
  
Join Date: Nov 2006
Location: UK
Posts: 1,164
 

Default Re: Group all CSS into one file

Warning - Off Topic!

Mobile -v- Desktop
Acid Test - Out of 28 orders yesterday, here is a breakdown
Desktop = 24
Mobile = 3
Tablet = 1

I *think* that whilst being Desktop -v- Tablet -v- Mobile aware is important, it is not the only "Holy Grail".

Likewise speed is important but again (IMHO) not the only "Holy Grail".

It is all about Content - Responsive - Speed.

Just my two cents (pence)

I'll get my coat!

Kind regards

ITVV
__________________
X-Cart Pro 4.7.12 Active and working great with reBOOT-reDUX
X-Cart Pro 4.6.6 Retired after 6 years of first class service
X-Cart Pro 4.1.7 Retired after 9 years of first class service

Apache: 2.4.25
PHP: 7.4.5
MariaDB: 10.1.44
Arch: x86_64
Reply With Quote
  #7  
Old 03-16-2017, 01:32 AM
 
Triple A Racing Triple A Racing is offline
 

X-Wizard
  
Join Date: Jul 2008
Location: Manchester UK
Posts: 1,028
 

Default Re: Group all CSS into one file

Quote:
Originally Posted by ITVV
Warning - Off Topic!
Mobile -v- Desktop
Acid Test - Out of 28 orders yesterday, here is a breakdown
Desktop = 24
Mobile = 3
Tablet = 1
Warning - Off Topic!
Secondhand tea caddy sales in Barnsley don't count as mainstream data.....
Quote:
I *think* that whilst being Desktop -v- Tablet -v- Mobile aware is important, it is not the only "Holy Grail".
Yep agreed albeit it's now mobile led coding in many areas as well as just commerce to be fair
Quote:
Likewise speed is important but again (IMHO) not the only "Holy Grail".
Yep agreed again but as you and I may fondly remember Commodore 64 computers and cassette tapes (!) many customers have the patience of a gnat and thus speed is becoming more and more of a factor. Our Dev Store is much, much faster than out live store currently and next month we plan to move our live over to our dev store location / setup as a result. At the time of writing this message, the XC5 installation of both is almost the same, apart from a tiny bit of extra 'garnish' on the dev store so that's not an XCart 5 speed issue. It's simply hosting enhancements that make the difference
Quote:
It is all about Content - Responsive - Speed.
Yes fully agreed. Despite any "where there there's muck there's brass" allowances... you cannot polish a .... as Yorkshire people know more than most
Quote:
Just my two cents (pence) I'll get my coat!
Always well worth adding other valid perspectives so don't leave yet!
__________________
Dev Store & Live Store XC Business 5.4.1.35
Server; Ubuntu 22.04.2 LTS (HWE 6.2.0.26.26 Kernel)) / Plesk Obsidian
Nginx 1.20.4 / Apache 2.4.52 (Ubuntu Backported) / MariaDB 10.11.4 / PHP 7.4.33
Reply With Quote

The following user thanks Triple A Racing for this useful post:
ITVV (03-16-2017)
  #8  
Old 03-16-2017, 01:44 AM
 
ITVV ITVV is online now
 

X-Wizard
  
Join Date: Nov 2006
Location: UK
Posts: 1,164
 

Default Re: Group all CSS into one file



Lancashire -v- Yorkshire

I like tea bags and I hate 'muck'

Regards

ITVV
__________________
X-Cart Pro 4.7.12 Active and working great with reBOOT-reDUX
X-Cart Pro 4.6.6 Retired after 6 years of first class service
X-Cart Pro 4.1.7 Retired after 9 years of first class service

Apache: 2.4.25
PHP: 7.4.5
MariaDB: 10.1.44
Arch: x86_64
Reply With Quote

The following user thanks ITVV for this useful post:
Triple A Racing (03-16-2017)
  #9  
Old 03-17-2017, 06:16 AM
 
xgarb xgarb is online now
 

eXpert
  
Join Date: Jul 2004
Location: UK
Posts: 263
 

Default Re: Group all CSS into one file

This tool has got my critical desktop CSS loaded in the head. Need to get mobile in there as well.

https://jonassebastianohlsson.com/criticalpathcssgenerator/
__________________
Core version: 5.5.xx
Reply With Quote
  #10  
Old 03-17-2017, 07:43 AM
 
Triple A Racing Triple A Racing is offline
 

X-Wizard
  
Join Date: Jul 2008
Location: Manchester UK
Posts: 1,028
 

Default Re: Group all CSS into one file

Quote:
Originally Posted by xgarb
This tool has got my critical desktop CSS loaded in the head. Need to get mobile in there as well https://jonassebastianohlsson.com/criticalpathcssgenerator/
Great info. Our own view is that Nirvana aka XC5.3.3.* should be doing this by default though, as opposed to us store owners having to take on basic coding challenges themselves via Custom Modules and/or core file hacks. Fingers crossed it's already in the XC5 in-tray.

Having joked with @ITVV we then analysed our own orders since 1/1/17 afterwards and mobile orders do lead desktop orders, only slightly though.... 54% v 46% but iPads and some tablets count as mobile too in that data, because of their non desktop OS. 'Mobile First' coding is definitely becoming more and more accepted now in many new software releases elsewhere, as we said previously.
__________________
Dev Store & Live Store XC Business 5.4.1.35
Server; Ubuntu 22.04.2 LTS (HWE 6.2.0.26.26 Kernel)) / Plesk Obsidian
Nginx 1.20.4 / Apache 2.4.52 (Ubuntu Backported) / MariaDB 10.11.4 / PHP 7.4.33
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:31 PM.

   

 
X-Cart forums © 2001-2020