Search code examples
javascriptjscompress

At what stage do you compress/minimize javascript?


When building, or "on the fly" (perhaps with caching) when the users request pages.

And what are the dis/advantages of each.


Solution

  • When the site moves from dev to the live server.

    I always have an uncompressed version of the JS on the dev server and a minimized version on the live server.

    The advantage of that is when developing i can run into JS trouble and fix it very simply, but i need to run each changed script through a minimizer, but for me its not that much.