Created
April 17, 2013 01:00
-
-
Save noyb34/5400955 to your computer and use it in GitHub Desktop.
This PHP code combine all my css files into one therefore reducing the number of http request to the server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // combine all CSS files | |
header('Content-type: text/css'); | |
$path_to_css = '/css'; // edit path to css directory | |
function get_files($dir = '.', $sort = 0) { | |
$files = scandir($dir, $sort); | |
$files = array_diff($files, array('.', '..')); | |
return $files; | |
} | |
$files = get_files($path_to_css, 1); | |
foreach($files as $file) { | |
include_once($path_to_css . '/' . $file); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment