How can I easily reduce the size of WordPress installation from development to production?

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:

  • via <script> tags in any of the template files
  • queued using wp_enqueue_script
  • otherwise echoed into the template files by another function

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: