dynamically generated JS/CSS

Wondering if anyone has information regarding dynamic vs static references to JS/CSS files.

Assuming that the server side is properly optimized (memcached), is there any downside to using a server-side process to aggregate and minify JS/CSS files, as opposed to doing so at build time.

For instance, having the references in a script tag for a dynamically generated javascript:

/servlet/bundle=script1.js,script2.js

vs, a build time process that bundles and has the reference point to a true static file:

/js/bundled-scripts.js

i guess my question is:

is a path to a true static file better than a file path to a service that would serve up a cached output of the static file?

thanks!

nope, a lot of larger sites actually use the dynamic method you are considering. Just watch out for query params and cacheability (particularly proxies) - if you can do it with URL rewrites then it would be better but either is pretty good. The one benefit you get at build time is that you can do something like hash the file and use the hash as the name to give it a long expires - otherwise you need to make sure to get some cache-busting versioning into the path in your HTML.

Having them build dynamically is more efficient to update and to call the JS you need when you need.

Having is pre-compiled is less stress on the CPU.

You have to make an edge case test