Current time: 12-15-2019, 05:42 PM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
dynamically generated JS/CSS
02-17-2012, 05:04 AM
Post: #1
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 j

/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!
Find all posts by this user
Quote this message in a reply
02-17-2012, 07:26 AM
Post: #2
RE: dynamically generated JS/CSS
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.
Visit this user's website Find all posts by this user
Quote this message in a reply
02-17-2012, 09:40 AM
Post: #3
RE: dynamically generated JS/CSS
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
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)