Reputation: 21749
I have many PHP and HTML files. And they have lots of Javascript (jQuery). Is it possible to run some function in PHP or whatever, that that javascript code would be "compressed". Or in other words, minified - automatically? Or it is not possible and I have to do that manually (put all that Javascript code in one file and use compressor online or so on)? Thank you.
Upvotes: 1
Views: 1307
Reputation: 38352
Do look at https://github.com/web-developer/Resource-Handler. This is a on the fly compressor and minifyer for your js. This requires least configuration or hassle, unlike the other one suggested .
RESOURCE HANDLER
Upvotes: 0
Reputation: 15390
You can also use JSMin: https://github.com/rgrove/jsmin-php/
Upvotes: 0
Reputation: 40673
Unless all of your functions are one-offs, your JS should all be in one file to begin with...or at least all in one file after minimizing.
You can look at PHP-minify as one way to automate things:
http://code.google.com/p/minify/
Upvotes: 2