tag:blogger.com,1999:blog-13286014.post113873715499381285..comments2023-09-02T22:04:21.508+05:30Comments on Bin-Blog: Compressing JavaScript file on the fly using JSMinBinny V Ahttp://www.blogger.com/profile/17219747953793699351noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-13286014.post-13007542548253483552008-11-20T00:09:00.000+05:302008-11-20T00:09:00.000+05:30I know this is an old post, but I thought I provid...I know this is an old post, but I thought I provide a little guidance to anyone trying to minify their javascript. I would not use Binny's php example, because it opens up access to other files on your webserver. For example, all a malicious user has to do is browse to one of your scripts, say:<BR/><BR/>jsmin.php?file=../lib/db.php <BR/><BR/>And then they will see code that you most likely didn't want them to see. <BR/><BR/>The way I solve this issue is I built a script that minifies all of the JS files in a given directory, and then puts them in a subdirectory called "compressed". I have an .htaccess file in the js/ folder which rewrites the url to serve up compressed JS from the compressed folder/. I run this minify script whenever I add or edit my javascript files. Using this method, you keep clean, original copies of your code, but you serve up compressed copies. I hope this helps someone with their workflow.Toddhttps://www.blogger.com/profile/07816241915008137030noreply@blogger.comtag:blogger.com,1999:blog-13286014.post-38660978295283472222007-08-23T11:27:00.000+05:302007-08-23T11:27:00.000+05:30@chaoskaizerThanks - corrected now.@chaoskaizer<BR/>Thanks - corrected now.Binny V Ahttps://www.blogger.com/profile/17219747953793699351noreply@blogger.comtag:blogger.com,1999:blog-13286014.post-7064824592748493082007-08-21T14:09:00.000+05:302007-08-21T14:09:00.000+05:30Nice tipsthere is some typolink href="jsmin.php?fi...Nice tips<BR/><BR/>there is some typo<BR/><BR/>link href="jsmin.php?file=your_js_file.js" rel="stylesheet" type="text/css" /<BR/><BR/>is for linking stylesheet files not javascripts.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-13286014.post-1142963712409138802006-03-21T23:25:00.000+05:302006-03-21T23:25:00.000+05:30Hey, great information! I had been looking on the ...Hey, great information! I had been looking on the net how to use the jsmin php file... thanks a lot.Anonymousnoreply@blogger.com