Sometimes it happens that cheap but fast/reliable hosting plan has the drawback to have only 50MB/100 MB of local space, for files and database.
Now, before going to production, I delete manually some files. For example development version of CSS and javascript, plugin language files that I do not use, etc.
Is there a software or a batch script that can help me to reduce the size of my WordPress installation before deploying it to production server?
I would argue that this is simply not possible (or extremely difficult) to do in an automated fashion, as there are so many different files which could be included or used in so many different places.
I’ll take javascript files as an example. They could be included:
<script>
tags in any of the template fileswp_enqueue_script
That’s just an example of three ways, I’m sure there’s many more – what I am saying is that it would be difficult to ascertain which files are actually used.
One thing you could look into, however, would be the minification of stylesheets, javascript and images, only deploying the minified versions to the server. There are a number of different services for each:
When you are minify your javascript and CSS. I doubt you will get over 1MB of saved disk space. Maybe using a tool like smush.it or ImageOptim will make a significant (over 1MB) difference. Something that might help a lot (especially if you are using PNG’s is to try to move your images to sprites. With the algorithm used it can compress images quite nicely (not guaranteed though)
Your best bet will be to remove all themes not used and all plugins not used. Nothing else you can do will really make a difference. If you site doesn’t fit in 50 or 100MB of space shaving 20KB off your CSS and/or javascript won’t help.
I’m not aware of such a script but maybe it would be good to develop one? The first step would be to identify what is possible to delete. Maybe you could turn this question into a community wiki page and people could collaborate on that information?
Also but only tangentially related I’m a huge fan of A Small Orange web hosting in no small part due to the fact they have a US$25/year account with 150Mb of storage (they have been my webhost for 5+ years.)
You could start by using the WordPress Capistrano Git plugin:
http://github.com/jestro/wordpress-capistrano
This will automate your deploys to the server. Then you could setup some of these other ideas to run on deploy as well.
http://shinylittlething.com/2010/01/20/css-minification-on-the-fly/
Deployment and minification is something that the Rails world (the one I’m most familiar with outside of WordPress) has down.
I suppose my answer may not hit your ‘easy’ qualitification in the question though.