JavaScript File Combiner

I created this JavaScript File Combiner because many times I need to combine all my JavaScript files into one file. This is usually very useful when I want to compile my code using Babel. I looked around to find a JavaScript File Combiner online but couldn’t find one that suited me. I decided to build my own using PHP. I suggest running this script on a local server. If you are using this for Phaser Games I recommend NOT including the phaser.min.js file in the compile. This will make it easier to debug if there are problems in your combined code.

The benefits of using a JavaScript File Combiner

  • Browsers can download a single file quicker and more efficiently than downloading many small files.
  • combining all of your game’s JavaScript files and then minifying the single file, let’s you minify all the symbols that are shared among the different JavaScript files.
  • Fewer files to upload, link or convert. This is very useful when you are making your¬†Phaser Game into a mobile game or a FaceBook Game

 

How to use the JavaScript File Combiner

  1. Download the PHP script and place it on your local server

2. Copy your game’s JavaScript folder to the same location as the PHP script.

I suggest renaming your folder to the name of your game if you plan on combining multiple files.

3. create a new folder named output

4. Change the game1 placeholder name to the name of your game. There are 3 places that you’ll need to change

5.  Run the scan.php in your browser

6. Test your combined .js file before compiling. If your browser says it can not find a class then move that class to the top of the file.