Reputation: 816
I'm using multiple CSS file in a project and also using a Php file as "stylesheet" to load all the CSS into a single file with compress them all. For that I'm using the following code:
$cssFiles = array("reset.css", "main.css", "plugin.css");
$css = "";
foreach($cssFiles as $cssFile){
$css .= file_get_contents($cssFile);
}
header("Content-type: text/css");
echo($css);
Now I need to know what is the advantages or disadvantages of this process?
I'm doing the same thing for javascript files too.
Thanks.
Upvotes: 0
Views: 269
Reputation: 2782
Cons:
Pros: I Really found hard to think in any pro here... maybe the non use of other tools than PHP to implement dynamic CSS and JS?
Upvotes: 1
Reputation: 596
I would suggest instead of doing that using php, use grunt to combine them and minify them
This question explains better how you can do that:
How to concatenate and minify multiple CSS and JavaScript files with Grunt.js (0.3.x)
Upvotes: 1