I gave a talk about RequireJS with jQuery at the jQuery Conference today. Here are the slides:
Thanks to the folks that came to the talk! I had a great time at the conference.
If you went to the talk, please feel free to rate the talk so I can improve for the next time.
5 comments:
Hi James.
I live on the other side of the planet and I couldn’t attend the talk, but thanks for the slides.
I see that the CommonJS pattern is not mentioned. Would you recommend those writing client side code to use or avoid the CommonJS pattern for strictly client-side scripts? Is the RequireJS pattern more efficient?
Thanks,
Alexander Teinum
Hi Alexander: Yes, I believe the RequireJS pattern to be more efficient and portable for client side scripts -- no need to carry around a transform server or use more inefficient loading techniques.
Also this talk was geared to primarily browser front end developers. When I asked about server side JS in the room, there not that many hands that went up.
So I was focusing the talk on making their work more productive with RequireJS.
Thanks for the quick answer. I will stick to the RequireJS pattern for my client-side stuff then.
Alexander
James, hi!
How do I replace IE conditional vomit with RequireJs?
[if IE]
script type="text/javascript" src="InventoryMetrics/js/highcharts/excanvas.compiled.js"></script
[endif]
Also, did you have a chance to talk with Resig how he feels about your work and if it will be included in jQuery 1.5?
Hi Les!
For IE-only calls, you can always do the following:
if (isIE) {
var req = require;
req(["InventoryMetrics/js/highcharts/excanvas.compiled.js"], function () {});
}
I did the require mapping to req to avoid picking it up in a build. Although, if you do not mind it being in a build, you do not need to do that.
If I misunderstood, please feel free to give more detail on the use case.
I did get a chance to talk briefly with John about what sort of requirements he has for script loading in jQuery. There is strong overlap in the general requirements and what RequireJS can provide.
It seems mobile support and templating are more important for jQuery at the moment, and I believe John is still deciding what solution he likes best for script loading.
I do hope to engage John and the rest of the jQuery team more when they get closer to working through a script loader solution. My hope is at the bare minimum we can agree on a loader API. Ideally we can share code too, but we'll see.
Post a Comment