[Sugar-devel] sugar-web - How to load non-AMD js modules / libs?

Manuel Quiñones manuq at laptop.org
Mon Nov 4 11:54:01 EST 2013


2013/11/4 Code <iraguet at activitycentral.com>:
> I think this is off-topic...
> BTW: perhaps you wanna see this thread from RequireJS' list where James
> Burke (core developer of RequireJS lib) talks about these syntax forms.
> If there is something realted to this to add, would u open a new thread,
> please?
>
>
> Getting back to the former topic (loading non-AMD modules):
> There is another approach, require.config() calls are additive, so it is
> possible to call config from other file than loader.js and require merges
> it.
>
> example of a require.config() from activity.js:
> https://gist.github.com/code-sur/7305059  ...loader.js stills as it is in
> sugar-web-template
>
> pros:
> * no need to modify loader.js
> * some developers would set other requirejs options
>
> cons:
> * whole config may spreads among many files
>
> The last "con" may be a "pro" if you want to clearly separete the framework
> config from the activity specific config

Yeah.  I think it is up to the activity developer to choose one or the
other.  The shim looks more prominent in RequireJS docs.

Here is how I used the shim in Gears activity, just for reference:
https://github.com/manuq/gears-activity/blob/master/js/loader.js

By the way, I have talked with the developer of the lib involved,
gearsketch, and he is happy if I provide a patch to make his code an
AMD module.  In general I think its good to do this.

-- 
.. manuq ..


More information about the Sugar-devel mailing list