I separate many CSS/JS so it's easier to work in and look over. But when the website loads, it has to load all those JS and CSS files and that will extend the loading times more and more.
So I was trying to put a simple php script in my website that takes all the CSS content and put it in 1 file. Same goes for the JS content.
It looks like this ($data['js'] and $data['css'] are arrays with all the files):
<?php
    $jsData = "";
    $cssData = "";
    foreach($data['js'] as $js) {
        $jsData .= file_get_contents($js);
    }
    foreach($data['css'] as $css) {
        $cssData .= file_get_contents($css);
    }
    file_put_contents('static/js/javascript.js', $jsData);
    file_put_contents('static/css/style.css', $cssData);
?>
<script type="text/javascript" src="static/js/javascript.js"></script>
<link href="static/css/style.css" rel="stylesheet" type="text/css">
As I'm still a beginner I wanted to ask you for tips/suggestions, What do you guys think?
Thank you
