Reputation: 100020
Doesn't using Browserify to load scripts like jQuery preclude the potentials benefits of using a CDN outlined here:
http://encosia.com/3-reasons-why-you-should-let-google-host-jquery-for-you/
"Potentially the greatest benefit of using the Google AJAX Libraries CDN is that your users may not need to download jQuery at all. No matter how well optimized your site is, if you’re hosting jQuery locally then your users must download it at least once. Each of your users probably already has dozens of identical copies of jQuery in their browser’s cache, but those copies of jQuery are ignored when they visit your site. However, when a browser sees references to CDN-hosted copies of jQuery, it understands that all of those references do refer to the exact same file. With all of these CDN references point to exactly the same URLs, the browser can trust that those files truly are identical and won’t waste time re-requesting the file if it’s already cached. Thus, the browser is able to use a single copy that’s cached on-disk, regardless of which site the CDN references appear on."
if so, would that mean you would want to include jQuery in the <head>
and keep it out of your Browserify bundle?
Upvotes: 1
Views: 136
Reputation: 26807
Doesn't using Browserify to load scripts like jQuery preclude the potentials benefits of using a CDN outlined here:
Yes.
would that mean you would want to include jQuery in the
<head>
and keep it out of your Browserify bundle?
Yessir, then you can use browserify-shim so you can still require()
jQuery in your browserified modules.
Upvotes: 2