If your website has a sufficient amount of static content, it might be a good
This blog, for example, shows the static content as
soon as possible, allowing its visitors to read the main content (the article)
while the not-so-important content (like Facebook Like buttons, “Web 2.0”
widgets and all that crap) is on its way from the server.
I use the following snippet to load external JS:
I put all that stuff in a closure so nothing gets exported to to the global
namespace. Note that the
setTimeout trick is from here.
- You can load less.js too, just trigger a
less.refresh()after it has been loaded.
- Have a look at Richard Neil Ilagan’s implementation as well.