I wrote about AMD and RequireJs recently: http://integralist.co.uk/post/11705798780/beginners-guide-to-amd-and-requirejs
Either you load scripts asynchronously and then monody each 'module' separately using uglifyjs/google compiler/yui etc, or you use RequireJs' build script which finds all the modules you use in your top level script and bungs them into a single file and minifies that single file. The trade off is multiple http requests or one single http request but with a bigger pay load. Because mobile devices are nowadays becoming more and more used to access the web I prefer going the build script route. As multiple http requests on a mobile device could be problematic with signal dropping out. Sent from my iPhone On 4 Nov 2011, at 10:47, north <[email protected]> wrote: > YSlow is supposed to give you hints on what you could be doing better. > I wouldn't take the grade all to seriously. You could also use > Google's Pagespeed to get "a second opinion". > > Even if you load modules asynchronously, you still have the additional > http-requests and the overhead that comes with them. So when using AMD/ > require.js you have to find the the right balance, I'd say. Loading 20 > or so modules separately is probably not a good idea. You should check > which ones could be bundled (in the build process). > > I don't know if you've already seen it, but there's an optimizer tool > for require.js which might help you with this: > http://requirejs.org/docs/optimization.html > > On 4 Nov., 00:29, dtang85 <[email protected]> wrote: >> I'm using Require.js to load AMD modules and dependency scripts (like >> plugins). Not all AMD modules are used on each page so I conditionally >> load external scripts when those modules are present on the page. One >> of my modules is using Google Maps API, which loads several other >> scripts. When I run my site through YSlow, I get dinged on my score >> because I have too many scripts loaded, despite them being loaded >> asynchronously. Is there a way to tell YSlow that I loaded these >> asynchronously, or am I doing something wrong? > > -- > To view archived discussions from the original JSMentors Mailman list: > http://www.mail-archive.com/[email protected]/ > > To search via a non-Google archive, visit here: > http://www.mail-archive.com/[email protected]/ > > To unsubscribe from this group, send email to > [email protected] -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
