views:

92

answers:

2

I'm a kind of big rookie, using Netbeans 6.9 as a PHP dev tool.

Currently I do develop and test locally on my PC using XAMPP/Apache/MySQL and once done, use Netbeans "upload" facility to the production server on the web.

I was wondering if there's a Netbeans tool capable of minifying js/CSS files on upload, or a tool to minify the whole "production" environement, on request.

+1  A: 

Not integrated with Netbeans but will do the trick for what you want: http://code.google.com/p/minify/

Chris
I personally prefer the YUI Compressor (http://developer.yahoo.com/yui/compressor/). Same thing though :D
Nathan Loding
Is there a best practice to minify only the "production" website?
Riccardo
In terms of best practice, "minify" your code before you put it into production is really only suggestion I can make. My suggestion is to write a script to minify your code when you are ready to push to production.
Chris
If you have numerous scripts, it'd be good to combine them into a single script so the browser is making a single HTTP request instead of a dozen requests. The file will be larger, but if it's minified, it shouldn't be terrible. I hate Wordpress blogs that have 22 JS files and 30 CSS files.
Nathan Loding
Nathan, same here. I'm looking at W3 Total cache, seems quite nice doing a part of the job. Needs tuning and some drawbacks: it looks like it can cache and minify external JS (according to YSlow I have 26... ARRRGGHHH!!!), however you will have to continuously check for updated versions of cached JS....
Riccardo
It take some management but there are benefits. Make it work.
Nathan Loding
A: 

I usually write a deployment script that does all these things for me: It copies the current development version to a deployment folder, filtering out files I don't need, generating the correct settings files, and a bunch of other deployment-related tasks. The result is a folder that matches the folder structure on the web server exactly; from there, all I need to do is upload everything. On *nix systems, this is even more powerful because pretty much everything is designed to be scriptable. If you adopt such a scheme, all you need is a scriptable minifier, add it to the deployment script and you're all set.

tdammers
At the moment Netbeans itself is capable to mantain the same structure on the production server in such a way, once a source file is ready to be deployed, I just force "upload" and Netbeans will do the rest, storing the source file accordingly in the proper folder on the production server....
Riccardo