My current code
I started writing an API that loads, minimizes and returns javascript files to a single file using PHP. This is achieved by specifying the PHP file from the script tag in the HMTL, for example:
<script type="text/javascript" src="https://libraries.sinemaculammviii.com/jsapi.php"></script>
This jsapi.php page processes javascript files and displays a miniature javascript with the header:
header("Content-Type: text/javascript");
My question
Is this a bad method to load javascript files? Would it be much faster and more reliable to download javascript files separately by simply pointing to the .js file in the src attribute?
If you want to see my code for the full API, check out this one . The link also explains in detail what I am doing and why.
source share