Hello All,
Today, we will combine CSS files.
This step 4 and the previous (step 3) are brothers. They runs altoghter. However, you can use one without the other. This step (step 4) is less important over the previous (step 3).
With this step, you will combine all CSS files into one. Thus, you will reduce the number of HTTP requests, which accelerates the rendering of your site.
This step is quite difficult. If you have a minimum knowledge in the architecture of the CS-Cart templates, and in CSS is a plus.
In fact, only points from #11 to #15 are difficults. Take your time. You need to change every:
<link href="/skins/YOUR-SKIN/customer/NAME-OF-CSS-FILE.css" rel="stylesheet" type="text/css" />
```<br />
<br />
With this only ONE:<br />
<br />
```php
<link href="/skins/YOUR-SKIN/customer/big.css" rel="stylesheet" type="text/css" />
```<br />
<br />
Materially speaking, I forget, and I [B]DO NOT include the CSS file for printing "print.css"[/B]. It is a voluntary forgetfulness:<br />
<br />
```php
<link href="/gg/skins/default_blue/customer/print.css" rel="stylesheet" media="print" type="text/css" />
```<br />
<br />
[B][U][COLOR="Red"]WARNING![/COLOR][/U][/B]<br />
<br />
Save your directory "/skins/.../customer" from your server to your desktop before you follow this step!<br />
<br />
*****<br />
<br />
[B]Preamble[/B]:<br />
<br />
I'll take the demo site of CS-Cart as an example: [url]http://demo.cs-cart.com/[/url]. If it bothers someone I can take a different site.<br />
<br />
Test it with GTMetrix:<br />
<br />
[url]http://gtmetrix.com/reports/demo.cs-cart.com/1j0TQsKJ[/url]<br />
<br />
Click on the "Page Speed" tab, then click the "Combine external CSS" link<br />
<br />
*****<br />
<br />
1 - Open all the CSS files included under the "Combine external CSS" link<br />
<br />
2 - Copy the content of the first CSS file<br />
<br />
3 - Open a new text document with notepad<br />
<br />
4 - Paste the content of the first CSS file in this document<br />
<br />
5 - Do the same with ALL CSS files<br />
<br />
6 - Now you have a large CSS document with the contents of ALL CSS files<br />
<br />
7 - Save it as "big.css" on your desktop<br />
<br />
8 - Copy the content of "big.css"<br />
<br />
9 - Save "big.css" on your desktop<br />
<br />
10 - Upload "big.css" on the root of your site skin "/skins/.../customer"<br />
<br />
11 - Search all files containing text: [B]rel ="stylesheet"[/B]. For this task, I use the free tool for Windows [URL="http://www.mythicsoft.com/agentransack"]Agent Ransack[/URL].<br />
<br />
12 - Delete all: ```php
<link href="/skins/YOUR-SKIN/customer/NAME-OF-CSS-FILE.css" <link rel="stylesheet" type="text/css" />
```<br />
<br />
13 - Remplace them with the only ONE: ```php
<link href="/skins/YOUR-SKIN/customer/big.css" rel="stylesheet" type="text/css" />
```<br />
<br />
14 - Materially speaking, I forget, and I [B]DO NOT include the CSS file for printing "print.css"[/B]. It is a voluntary forgetfulness:<br />
<br />
```php
<link href="/skins/YOUR-SKIN/customer/print.css" rel="stylesheet" media="print" type="text/css" />
```<br />
<br />
15 - When you find: [B]@import url('XXX.css');[/B], you must to delete it, and paste the full "[B]XXX.css[/B]" file here, replacing the statement "@import url('XXX.css');".<br />
<br />
16 - Save your templates.<br />
<br />
17 - Cleanup the templates cache<br />
<br />
18 - Test on your browser[COLOR="Red"][B][U]s[/U][/B][/COLOR]<br />
<br />
19 - Enjoy your GTMetrix results before/after!<br />
<br />
<br />
<br />
Lee Li Pop