If you are using PHP, simply follow these steps:
Edit the apache configuration file on your production machine and add this line to httpd.conf (then restart apache). On shared hosting, you should try .htaccess if you do not have access to httpd.conf.
SetEnv ENVIRONMENT production
This just adds a variable in apache indicating that you are running in production mode. On your development machine, change the meaning of “production” to “development” or something that makes sense to you.
Then in your PHP file, you can switch between loading full JS files and mini code, for example:
if(isset($_SERVER['ENVIRONMENT']) && $_SERVER['ENVIRONMENT'] == "production") { ... production minified JS here } else { ... development unminified JS here }
Jorre source share