Latest News: (loading..)

Search the Community

Showing results for tags 'speed'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News and Announcements
    • News and Announcements
    • Partner Announcements
    • Ambassadors
  • Commercial Support
    • Developer Feedback
  • osCommerce Online Merchant v2.x
    • General Support
    • Installation and Configuration
    • Upgrading from Earlier Versions (v2.x to v2.x)
    • Add-Ons
    • Tips and Tricks
    • Security
  • Development
    • osCommerce Online Merchant v2.4
    • osCommerce Online Merchant Community Bootstrap Edition
    • osCommerce Online Merchant v3.x
    • Development Proposals
  • General
    • OSCOMMERCE.TV
    • Next Steps / Optimizations / Marketing
    • Live Shop Reviews
    • E-Commerce Laws
    • General Discussions
    • PHP / SQL / Web Design

Found 1 result

  1. Hi, https://gtmetrix.com/ advises to combine all .css files into one. Then I found that: https://manas.tungare.name/software/css-compression-in-php/ leading me there https://gist.github.com/manastungare/2625128 and then this came out <?php $cssFiles = array( "ext/bootstrap/css/bootstrap.min.css", "custom.css", "user.css" ); /** * Ideally, you wouldn't need to change any code beyond this point. */ $buffer = ""; foreach ($cssFiles as $cssFile) { $buffer .= file_get_contents($cssFile); } // Remove comments $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer); // Remove space after colons //$buffer = str_replace(': ', ':', $buffer); // Remove whitespace //$buffer = str_replace(array("\r\n", "\r", "\n", "\t"), '', $buffer); // Collapse adjacent spaces into a single space //$buffer = ereg_replace(" {2,}", ' ',$buffer); $buffer = preg_replace('/[\t\r\n]+/', '', $buffer); $buffer = preg_replace('/[\s]{2,}/', ' ', $buffer); $buffer = str_replace(': ', ':', $buffer); // Remove spaces that might still be left where we know they aren't needed $buffer = str_replace(array('} '), '}', $buffer); $buffer = str_replace(array('{ '), '{', $buffer); $buffer = str_replace(array('; '), ';', $buffer); $buffer = str_replace(array(', '), ',', $buffer); $buffer = str_replace(array(' }'), '}', $buffer); $buffer = str_replace(array(' {'), '{', $buffer); $buffer = str_replace(array(' ;'), ';', $buffer); $buffer = str_replace(array(' ,'), ',', $buffer); // Enable GZip encoding. ob_start("ob_gzhandler"); // Enable caching header('Cache-Control: public'); // Expire in one day header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 86400) . ' GMT'); // Set the correct MIME type, because Apache won't set it for us header("Content-type: text/css"); // Write everything out echo($buffer); ?> Saved as css_compress.php loaded up to catalog root and included into template_top.php with <link rel="stylesheet" type="text/css" media="screen, print, projection" href="css_compress.php" /> instead of the single css files, only problem is now that glyphicon fonts (which i will get rid of anyway) gives 404. Another question would be how to get css files of addons into that array also. Any thoughts ideas? Best regards Christoph