[Answer]-Minimize JS at runtime or generate static?

1👍

In my experience it doesn’t matter all that much. This is down to the fact that both methods behave in a very similar way, as minification at runtime caches the results. Either in the file system in your static directory or in a cache such as memcached.

One downside to doing this at runtime though is that the first request will be slower, as the file or cache hasn’t been populated yet. And the downside to generating everything manually is exactly that, you have to generate everything manually when you make changes.

My workflow involves having all static files generated at runtime during development and having them all minified and saved during production. Django pipeline does a lot of this out of the box.

👤Matt

Leave a comment