Why write your own system?
- integration with source control systems
- automating your build, and so on
Assume you normally include the following script tags at the bottom of your html:
We'll replace this block with a single script tag that references all three files.
The .js is removed and the file names are separated with an ampersand:
We now require an index.php file within our script folder. The first code block transforms the GET parameters into an array (file1, file2, file3) and initializes the variables:
Finally, we return our compressed code to the browser with the appropriate MIME type:
// output content
Truncated by Planet PHP, read more at the original (another 3262 bytes)