I am looking to implement a PHP script that will serve combined, pre-gzipped, and minified JS and CSS files. You can find the source code for this script here: https://code.google.com/p/compress/
I have a WAMP localhost with WordPress installed.
Here's what I have done so far:
I have added three files (jsmin.php, cssmin.php, compress.php) in the child-theme's folder;
I created a directory 'min' within the child-theme folder;
I created a file 'compress_timestamp.php'
I added the following code into header.php (first tried functions.php then moved it to the first line of header.php)
require_once('compress_timestamp.php'); //load timestamp created by compress.php module sets field $compress_stamp=unix_timestamp<br> if (stripos($_SERVER['HTTP_ACCEPT_ENCODING'],'GZIP')!==false)<br> $gz='gz'; else $gz=null; echo '<link rel="stylesheet" type="text/css" href="min/css_schedule_'.$compress_stamp.'.css'.$gz.'" />',PHP_EOL; // the following scripts were combined into css_schedule // echo '<link rel="stylesheet" type="text/css" href="CSS/menu.css" />',PHP_EOL; // echo '<link rel="stylesheet" type="text/css" href="CSS/ThreeColumnFixed.css" />',PHP_EOL; // echo '<link rel="stylesheet" type="text/css" href="CSS/sprite.css" />',PHP_EOL; // echo '<link rel="stylesheet" type="text/css" href="CSS/iCal.css" />',PHP_EOL;
I have adjusted the lines according to the child theme and parent folders:
echo '<link rel="stylesheet" type="text/css" href="style.css" />',PHP_EOL; echo '<link rel="stylesheet" type="text/css" href="../twentyfourteen/style.css"
What steps may have been missed and what is the correct approach to ensure it works properly?
And once everything is set up, how do we launch that script remotely on XAMPP (VPS)?