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

Daniel Narvaez dwnarvaez at gmail.com
Fri Nov 1 19:25:06 EDT 2013


Yeah I think it make sense to mention it in the documentation, it's
something every developer will run into. I'd suggest to try and keep our
own documentation as short as possible and link out to the requirejs shim
doc though, to avoid duplication and help maintenance.

On Saturday, 2 November 2013, Code wrote:

> Thanks, Daniel!
> I'd rather use "shim", too.
>
> I think it's a common need to have non-AMD dependencies when building an
> activity.
> What do you think about finding out a canonical way to achieve this and
> write it down in "write your own activity" doc?
>
> I'm willing to make a pull-request with the updated doc.
>
> Thanks again,
> Code
>
>
> On Fri, Nov 1, 2013 at 6:18 PM, Daniel Narvaez <dwnarvaez at gmail.com<javascript:_e({}, 'cvml', 'dwnarvaez at gmail.com');>
> > wrote:
>
>> I think we have been suggesting to use the shim. Modifying loader.js
>> should be fine, the template one shouldn't change often.
>>
>>
>> On 1 November 2013 22:02, Code <iraguet at activitycentral.com<javascript:_e({}, 'cvml', 'iraguet at activitycentral.com');>
>> > wrote:
>>
>>> Hello, list!
>>> I'd like to add a non-AMD lib (AngularJS in this case) to my activity.
>>>
>>> Here only points out how to add AMD ones:
>>>
>>> http://developer.sugarlabs.org/activity.md.html#using%20other%20javascript%20libraries
>>>
>>> Of course there are workarounds like adding script tags (I'd rather not)
>>> or setting up the "shim" option from RequireJS config...
>>> https://github.com/code-sur/web-activity-POC/blob/master/js/loader.js
>>>
>>> But it seems that I shouldn't be touching the loader.js file, isn't it?
>>>
>>> Is there a standard/preferred way to achieve this?
>>>
>>>
>>> Thanks,
>>> Code
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Sugar-devel mailing list
>>> Sugar-devel at lists.sugarlabs.org <javascript:_e({}, 'cvml',
>>> 'Sugar-devel at lists.sugarlabs.org');>
>>> http://lists.sugarlabs.org/listinfo/sugar-devel
>>>
>>>
>>
>>
>> --
>> Daniel Narvaez
>>
>
>

-- 
Daniel Narvaez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20131102/ac315596/attachment-0001.html>


More information about the Sugar-devel mailing list